diff --git a/scripts/libraries/ml.py b/scripts/libraries/ml.py index 591d0da44..47e24723a 100644 --- a/scripts/libraries/ml.py +++ b/scripts/libraries/ml.py @@ -61,6 +61,7 @@ class MicroSpeech: self.audio_buffer = np.zeros((1, _SAMPLES_PER_STEP * 3), dtype=np.int16) self.spectrogram = np.zeros((1, _SLICE_COUNT * _SLICE_SIZE), dtype=np.int8) self.pred_history = np.zeros((_AVERAGE_WINDOW_SAMPLES, _CATEGORY_COUNT), dtype=np.float) + self.audio_started = False audio.init(channels=1, frequency=_AUDIO_FREQUENCY, gain_db=24, samples=_SAMPLES_PER_STEP * 2) def audio_callback(self, buf): @@ -78,11 +79,19 @@ class MicroSpeech: self.pred_history = np.roll(self.pred_history, -1, axis=0) self.pred_history[-1] = self.micro_speech.predict(self.spectrogram)[0] + def start_audio_streaming(self): + if self.audio_started is False: + self.spectrogram[:] = 0 + self.pred_history[:] = 0 + audio.start_streaming(self.audio_callback) + self.audio_started = True + + def stop_audio_streaming(self): + audio.stop_streaming() + self.audio_started = False + def listen(self, timeout=0, callback=None, threshold=0.65, filter=["Yes", "No"]): - self.spectrogram[:] = 0 - self.pred_history[:] = 0 - # Start audio streaming - audio.start_streaming(self.audio_callback) + self.start_audio_streaming() stat_ms = time.ticks_ms() while True: average_scores = np.mean(self.pred_history, axis=0) @@ -93,10 +102,12 @@ class MicroSpeech: self.pred_history[:] = 0 self.spectrogram[:] = 0 if callback is None: - audio.stop_streaming() + if timeout != -1: # non-blocking mode + self.stop_audio_streaming() return (label, average_scores) callback(label, average_scores) + if timeout == -1: # non-blocking mode + return (None, average_scores) if timeout != 0 and (time.ticks_ms() - stat_ms) > timeout: - audio.stop_streaming() - return (None, None) + self.stop_audio_streaming() time.sleep_ms(1) diff --git a/src/Makefile b/src/Makefile index 689e8e8fc..302f094ea 100755 --- a/src/Makefile +++ b/src/Makefile @@ -48,7 +48,6 @@ TOOLS=$(TOP_DIR)/../tools FW_DIR=$(BUILD)/bin OMV_DIR=omv UVC_DIR=uvc -CM4_DIR=cm4 BOOTLDR_DIR=bootloader CUBEAI_DIR=stm32cubeai CMSIS_DIR=hal/cmsis diff --git a/src/cm4/Makefile b/src/cm4/Makefile deleted file mode 100755 index 66344e329..000000000 --- a/src/cm4/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -# This file is part of the OpenMV project. -# -# Copyright (c) 2013-2021 Ibrahim Abdelkader -# Copyright (c) 2013-2021 Kwabena W. Agyeman -# -# This work is licensed under the MIT license, see the file LICENSE for details. -# -# CM4 firmware Makefile -SRC_C = $(wildcard src/*.c) -SRC_C += $(addprefix $(HAL_DIR)/src/, \ - stm32h7xx_hal.c \ - stm32h7xx_hal_cortex.c \ - stm32h7xx_hal_gpio.c \ - stm32h7xx_hal_pwr.c \ - stm32h7xx_hal_pwr_ex.c \ - stm32h7xx_hal_rcc.c \ - stm32h7xx_hal_rcc_ex.c \ - stm32h7xx_hal_rtc.c \ - stm32h7xx_hal_rtc_ex.c \ - stm32h7xx_hal_hsem.c \ -) -#SRCS += $(addprefix $(HAL_DIR)/src/, $(notdir $(wildcard ../$(HAL_DIR)/src/*.c))) - -SRC_C += $(addprefix $(CMSIS_DIR)/src/, \ - $(SYSTEM).c \ -) - -SRC_S += $(addprefix $(CMSIS_DIR)/src/, \ - $(STARTUP).s \ -) - -OBJS = $(addprefix $(BUILD)/, $(SRC_S:.s=.o)) -OBJS += $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) -OBJ_DIRS = $(sort $(dir $(OBJS))) - -all: | $(OBJ_DIRS) $(OBJS) -$(OBJ_DIRS): - $(MKDIR) -p $@ - -$(BUILD)/$(HAL_DIR)/src/%.o : $(TOP_DIR)/$(HAL_DIR)/src/%.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/$(CMSIS_DIR)/src/%.o : $(TOP_DIR)/$(CMSIS_DIR)/src/%.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/$(CMSIS_DIR)/src/%.o : $(TOP_DIR)/$(CMSIS_DIR)/src/%.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - -$(BUILD)/%.o : %.c - $(ECHO) "CC $<" - $(CC) $(CFLAGS) -c -o $@ $< - -$(BUILD)/%.o : %.s - $(ECHO) "AS $<" - $(AS) $(AFLAGS) $< -o $@ - --include $(OBJS:%.o=%.d) diff --git a/src/cm4/src/main.c b/src/cm4/src/main.c deleted file mode 100644 index a7986f945..000000000 --- a/src/cm4/src/main.c +++ /dev/null @@ -1,62 +0,0 @@ -#include STM32_HAL_H -#define HSEM_ID_0 (0U) /* HW semaphore 0*/ -#define LED_RED GPIO_PIN_5 -#define LED_GREEN GPIO_PIN_6 -#define LED_BLUE GPIO_PIN_7 - -void blink_led(uint32_t led) { - __GPIOK_CLK_ENABLE(); - GPIO_InitTypeDef GPIO_InitStructure; - GPIO_InitStructure.Pin = led; - GPIO_InitStructure.Pull = GPIO_PULLDOWN; - GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStructure.Speed = GPIO_SPEED_LOW; - HAL_GPIO_Init(GPIOK, &GPIO_InitStructure); - HAL_GPIO_WritePin(GPIOK, led, GPIO_PIN_SET); - - for (int i = 0; i < 5; i++) { - HAL_GPIO_WritePin(GPIOK, led, GPIO_PIN_RESET); - HAL_Delay(100); - HAL_GPIO_WritePin(GPIOK, led, GPIO_PIN_SET); - HAL_Delay(100); - } - __GPIOK_CLK_DISABLE(); -} - -int main(void) { - HAL_Init(); - - blink_led(LED_GREEN); - - // HW semaphore Clock enable - __HAL_RCC_HSEM_CLK_ENABLE(); - - // Configure the NVIC HSEM notification interrupt for CM4 - HAL_NVIC_SetPriority(HSEM2_IRQn, 0, 0); - HAL_NVIC_EnableIRQ(HSEM2_IRQn); - - // Activate HSEM notification for Cortex-M4 - HAL_HSEM_ActivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0)); - - HAL_PWREx_ClearPendingEvent(); - HAL_PWREx_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFE, PWR_D2_DOMAIN); - - HAL_PWREx_ClearPendingEvent(); - - // Deactivate HSEM notification for Cortex-M4 - HAL_HSEM_DeactivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0)); - - // HW semaphore Clock disable - __HAL_RCC_HSEM_CLK_DISABLE(); - - // Enter D3 domain to DStandby mode - HAL_PWREx_EnterSTANDBYMode(PWR_D3_DOMAIN); - - // Enter D2 domain to DStandby mode - HAL_PWREx_EnterSTANDBYMode(PWR_D2_DOMAIN); - - HAL_Init(); - while (1) { - blink_led(LED_RED); - } -} diff --git a/src/cm4/src/stm32h7xx_it.c b/src/cm4/src/stm32h7xx_it.c deleted file mode 100644 index 44bb36481..000000000 --- a/src/cm4/src/stm32h7xx_it.c +++ /dev/null @@ -1,128 +0,0 @@ -/** - ****************************************************************************** - * @file PWR/PWR_STANDBY_RTC/CM4/Src/stm32h7xx_it.c - * @author MCD Application Team - * @brief Main Interrupt Service Routines. - * This file provides template for all exceptions handler and - * peripherals interrupt service routine. - ****************************************************************************** - * @attention - * - *

© Copyright (c) 2019 STMicroelectronics. - * All rights reserved.

- * - * This software component is licensed by ST under BSD 3-Clause license, - * the "License"; You may not use this file except in compliance with the - * License. You may obtain a copy of the License at: - * opensource.org/licenses/BSD-3-Clause - * - ****************************************************************************** - */ -#include STM32_HAL_H -/** - * @brief This function handles NMI exception. - * @param None - * @retval None - */ -void NMI_Handler(void) { -} - -/** - * @brief This function handles Hard Fault exception. - * @param None - * @retval None - */ -void HardFault_Handler(void) { - /* Go to infinite loop when Hard Fault exception occurs */ - while (1) { - } -} - -/** - * @brief This function handles Memory Manage exception. - * @param None - * @retval None - */ -void MemManage_Handler(void) { - /* Go to infinite loop when Memory Manage exception occurs */ - while (1) { - } -} - -/** - * @brief This function handles Bus Fault exception. - * @param None - * @retval None - */ -void BusFault_Handler(void) { - /* Go to infinite loop when Bus Fault exception occurs */ - while (1) { - } -} - -/** - * @brief This function handles Usage Fault exception. - * @param None - * @retval None - */ -void UsageFault_Handler(void) { - /* Go to infinite loop when Usage Fault exception occurs */ - while (1) { - } -} - -/** - * @brief This function handles SVCall exception. - * @param None - * @retval None - */ -void SVC_Handler(void) { -} - -/** - * @brief This function handles Debug Monitor exception. - * @param None - * @retval None - */ -void DebugMon_Handler(void) { -} - -/** - * @brief This function handles PendSVC exception. - * @param None - * @retval None - */ -void PendSV_Handler(void) { -} - -/** - * @brief This function handles SysTick Handler. - * @param None - * @retval None - */ -void SysTick_Handler(void) { - HAL_IncTick(); -} - - -/** - * @brief This function handles HSEM2 wake-up interrupt request. - * @param None - * @retval None - */ -void HSEM2_IRQHandler(void) { - HAL_HSEM_IRQHandler(); -} - -void RTC_WKUP_IRQHandler(void) { - -} -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/src/cm4/stm32fxxx.ld.S b/src/cm4/stm32fxxx.ld.S deleted file mode 100644 index 52e722e83..000000000 --- a/src/cm4/stm32fxxx.ld.S +++ /dev/null @@ -1,102 +0,0 @@ -/* - * This file is part of the OpenMV project. - * - * Copyright (c) 2013-2021 Ibrahim Abdelkader - * Copyright (c) 2013-2021 Kwabena W. Agyeman - * - * This work is licensed under the MIT license, see the file LICENSE for details. - * - * Linker script for STM32 Devices. - */ - -/* Entry Point */ -ENTRY(Reset_Handler) - -#include "omv_boardconfig.h" - -/* Specify the memory areas */ -MEMORY -{ - RAM (xrw) : ORIGIN = OMV_CM4_RAM_ORIGIN, LENGTH = OMV_CM4_RAM_LENGTH - FLASH (rx) : ORIGIN = OMV_CM4_FLASH_ORIGIN, LENGTH = OMV_CM4_FLASH_LENGTH -} - -_heap_size = (1 * 1024); /* heap size */ -_stack_size = (4 * 1024); /* stack size */ - -/* Define output sections */ -SECTIONS -{ - /* The program code and other data goes into FLASH */ - .text : - { - . = ALIGN(4); - KEEP(*(.isr_vector))// ISR table - . = ALIGN(4); - *(.text) // .text sections (code) - . = ALIGN(4); - *(.text*) // .text* sections (code) - . = ALIGN(4); - *(.rodata) // .rodata sections (constants, strings, etc.) - . = ALIGN(4); - *(.rodata*) // .rodata* sections (constants, strings, etc.) - . = ALIGN(4); - _etext = .; // define a global symbols at end of code - } >FLASH - - /* used by the startup to initialize data */ - _sidata = LOADADDR(.data); - - /* Initialized data sections */ - .data : - { - . = ALIGN(4); - _sdata = .; // Create a global symbol at data start - _ram_start = .; - *(.data) // .data sections - - . = ALIGN(4); - *(.data*) // .data* sections - - . = ALIGN(4); - _edata = .; // define a global symbol at data end - } >RAM AT> FLASH - - /* Uninitialized data section */ - . = ALIGN(4); - .bss (NOLOAD) : - { - . = ALIGN(4); - _sbss = .; // Used by the startup to initialize the .bss secion - . = ALIGN(4); - *(.bss*) - . = ALIGN(4); - *(COMMON) - . = ALIGN(4); - _ebss = .; // define a global symbol at bss end - } >RAM - - ._heap (NOLOAD) : - { - . = ALIGN(4); - _heap_start = .; - . = . + _heap_size; - - . = ALIGN(4); - _heap_end = .; - - } >RAM - - /* Make sure there is enough ram for the stack */ - ._stack (NOLOAD) : - { - . = ALIGN(8); - _sstack = .; - . = . + _stack_size; - - . = ALIGN(8); - _estack = .; - } >RAM - - .ARM.attributes 0 : { *(.ARM.attributes) } -} diff --git a/src/micropython b/src/micropython index fff2e1fb5..6f4277b26 160000 --- a/src/micropython +++ b/src/micropython @@ -1 +1 @@ -Subproject commit fff2e1fb525cd8f92aadecbd9901abada1e891d1 +Subproject commit 6f4277b26d3d5f69001d64eaa6b0fcc47e527d1e diff --git a/src/omv/boards/ARDUINO_GIGA/imlib_config.h b/src/omv/boards/ARDUINO_GIGA/imlib_config.h index 2920428d4..dfd5de715 100644 --- a/src/omv/boards/ARDUINO_GIGA/imlib_config.h +++ b/src/omv/boards/ARDUINO_GIGA/imlib_config.h @@ -111,7 +111,7 @@ // Enable find_features() and built-in Haar cascades. (75KBs) #define IMLIB_ENABLE_FEATURES -#define IMLIB_ENABLE_FEATURES_BUILTIN_FACE_CASCADE +//#define IMLIB_ENABLE_FEATURES_BUILTIN_FACE_CASCADE //#define IMLIB_ENABLE_FEATURES_BUILTIN_EYES_CASCADE // Enable Tensor Flow diff --git a/src/omv/boards/ARDUINO_GIGA/manifest.py b/src/omv/boards/ARDUINO_GIGA/manifest.py index 2be31bcb4..83a4c1aec 100644 --- a/src/omv/boards/ARDUINO_GIGA/manifest.py +++ b/src/omv/boards/ARDUINO_GIGA/manifest.py @@ -13,6 +13,7 @@ freeze ("$(OMV_LIB_DIR)/", "display.py") freeze ("$(OMV_LIB_DIR)/", "ml.py") # Networking +require("ssl") require("ntptime") require("webrepl") freeze ("$(OMV_LIB_DIR)/", "rpc.py") diff --git a/src/omv/boards/ARDUINO_GIGA/omv_boardconfig.h b/src/omv/boards/ARDUINO_GIGA/omv_boardconfig.h index 348fde213..798d40168 100644 --- a/src/omv/boards/ARDUINO_GIGA/omv_boardconfig.h +++ b/src/omv/boards/ARDUINO_GIGA/omv_boardconfig.h @@ -107,26 +107,29 @@ // Linker script constants (see the linker script template stm32fxxx.ld.S). // Note: fb_alloc is a stack-based, dynamically allocated memory on FB. // The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp). -#define OMV_MAIN_MEMORY SRAM1 // Data, BSS memory. +#define OMV_MAIN_MEMORY AXI_SRAM // Data, BSS memory. #define OMV_STACK_MEMORY DTCM // stack memory #define OMV_STACK_SIZE (64K) #define OMV_FB_MEMORY DRAM // Framebuffer, fb_alloc #define OMV_FB_SIZE (3M) // FB memory: header + VGA/GS image -#define OMV_FB_ALLOC_SIZE (2M) // minimum fb alloc size +#define OMV_FB_ALLOC_SIZE (1M) // minimum fb alloc size #define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory. -#define OMV_FB_OVERLAY_SIZE (480K) // Fast fb_alloc memory size. +#define OMV_FB_OVERLAY_SIZE (450K) // Fast fb_alloc memory size. #define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer. #define OMV_JPEG_SIZE (1024 * 1024) // IDE JPEG buffer (header + data). -#define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory. +#define OMV_VOSPI_MEMORY DTCM // VoSPI buffer memory. #define OMV_VOSPI_SIZE (38K) #define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory. #define OMV_DMA_MEMORY_D1 AXI_SRAM // Domain 1 DMA buffers. #define OMV_DMA_MEMORY_D2 SRAM3 // Domain 2 DMA buffers. -#define OMV_DMA_MEMORY_D3 SRAM4 // Domain 3 DMA buffers. +#define OMV_OPENAMP_MEMORY SRAM4 +#define OMV_OPENAMP_SIZE (64K) +#define OMV_CORE1_MEMORY DRAM +#define OMV_CORE1_SIZE (512K) #define OMV_GC_BLOCK0_MEMORY SRAM1 // Main GC block. -#define OMV_GC_BLOCK0_SIZE (198K) +#define OMV_GC_BLOCK0_SIZE (256K) #define OMV_GC_BLOCK1_MEMORY DRAM // Extra GC block 1. -#define OMV_GC_BLOCK1_SIZE (2M) +#define OMV_GC_BLOCK1_SIZE (2560K) #define OMV_MSC_BUF_SIZE (2K) // USB MSC bot data #define OMV_VFS_BUF_SIZE (1K) // VFS struct + FATFS file buffer (624 bytes) #define OMV_SDRAM_SIZE (8 * 1024 * 1024) // This needs to be here for UVC firmware. @@ -147,8 +150,6 @@ #define OMV_AXI_SRAM_LENGTH 512K #define OMV_DRAM_ORIGIN 0xC0000000 #define OMV_DRAM_LENGTH 8M -#define OMV_CM4_RAM_ORIGIN 0x38000000 // Cortex-M4 memory @SRAM4. -#define OMV_CM4_RAM_LENGTH 16K // Flash configuration. #define OMV_FLASH_FFS_ORIGIN 0x08020000 @@ -157,8 +158,6 @@ #define OMV_FLASH_TXT_LENGTH 1792K #define OMV_FLASH_EXT_ORIGIN 0x90000000 #define OMV_FLASH_EXT_LENGTH 16M -#define OMV_CM4_FLASH_ORIGIN 0x08020000 -#define OMV_CM4_FLASH_LENGTH 128K // MDMA configuration #define OMV_MDMA_CHANNEL_DCMI_0 (0) diff --git a/src/omv/boards/ARDUINO_GIGA/omv_boardconfig.mk b/src/omv/boards/ARDUINO_GIGA/omv_boardconfig.mk index 9240e0b95..641033f7d 100755 --- a/src/omv/boards/ARDUINO_GIGA/omv_boardconfig.mk +++ b/src/omv/boards/ARDUINO_GIGA/omv_boardconfig.mk @@ -26,3 +26,5 @@ MICROPY_PY_BLUETOOTH = 1 MICROPY_BLUETOOTH_NIMBLE = 1 MICROPY_PY_AUDIO = 1 MICROPY_PY_DISPLAY = 1 +MICROPY_PY_OPENAMP = 1 +MICROPY_PY_OPENAMP_REMOTEPROC = 1 diff --git a/src/omv/boards/ARDUINO_GIGA/ulab_config.h b/src/omv/boards/ARDUINO_GIGA/ulab_config.h index 24ff7522a..3a1e9d4b5 100644 --- a/src/omv/boards/ARDUINO_GIGA/ulab_config.h +++ b/src/omv/boards/ARDUINO_GIGA/ulab_config.h @@ -11,8 +11,8 @@ #ifndef __ULAB_CONFIG_H__ #define __ULAB_CONFIG_H__ // Override ulab defaults here. +#define ULAB_SUPPORTS_COMPLEX (0) #define NDARRAY_BINARY_USES_FUN_POINTER (1) -#define ULAB_VECTORISE_USES_FUN_POINTER (1) #define ULAB_SCIPY_HAS_OPTIMIZE_MODULE (1) #define ULAB_SCIPY_HAS_SPECIAL_MODULE (0) #endif //__ULAB_CONFIG_H__ diff --git a/src/omv/boards/ARDUINO_NANO_33_BLE_SENSE/ulab_config.h b/src/omv/boards/ARDUINO_NANO_33_BLE_SENSE/ulab_config.h index 21f758a2f..cc5f96042 100644 --- a/src/omv/boards/ARDUINO_NANO_33_BLE_SENSE/ulab_config.h +++ b/src/omv/boards/ARDUINO_NANO_33_BLE_SENSE/ulab_config.h @@ -9,4 +9,7 @@ #ifndef __ULAB_CONFIG_H__ #define __ULAB_CONFIG_H__ // Override ulab defaults here. +#define ULAB_SUPPORTS_COMPLEX (0) +#define ULAB_SCIPY_HAS_OPTIMIZE_MODULE (1) +#define ULAB_SCIPY_HAS_SPECIAL_MODULE (0) #endif //__ULAB_CONFIG_H__ diff --git a/src/omv/boards/ARDUINO_NANO_RP2040_CONNECT/manifest.py b/src/omv/boards/ARDUINO_NANO_RP2040_CONNECT/manifest.py index 05ab6c551..114c79c28 100644 --- a/src/omv/boards/ARDUINO_NANO_RP2040_CONNECT/manifest.py +++ b/src/omv/boards/ARDUINO_NANO_RP2040_CONNECT/manifest.py @@ -11,6 +11,7 @@ require("neopixel") freeze ("$(OMV_LIB_DIR)/", "machine.py") # Networking +require("ssl") require("ntptime") require("webrepl") freeze ("$(OMV_LIB_DIR)/", "mqtt.py") diff --git a/src/omv/boards/ARDUINO_NANO_RP2040_CONNECT/ulab_config.h b/src/omv/boards/ARDUINO_NANO_RP2040_CONNECT/ulab_config.h index 21f758a2f..cc5f96042 100644 --- a/src/omv/boards/ARDUINO_NANO_RP2040_CONNECT/ulab_config.h +++ b/src/omv/boards/ARDUINO_NANO_RP2040_CONNECT/ulab_config.h @@ -9,4 +9,7 @@ #ifndef __ULAB_CONFIG_H__ #define __ULAB_CONFIG_H__ // Override ulab defaults here. +#define ULAB_SUPPORTS_COMPLEX (0) +#define ULAB_SCIPY_HAS_OPTIMIZE_MODULE (1) +#define ULAB_SCIPY_HAS_SPECIAL_MODULE (0) #endif //__ULAB_CONFIG_H__ diff --git a/src/omv/boards/ARDUINO_NICLA_VISION/manifest.py b/src/omv/boards/ARDUINO_NICLA_VISION/manifest.py index 41015027d..460ba0dd8 100644 --- a/src/omv/boards/ARDUINO_NICLA_VISION/manifest.py +++ b/src/omv/boards/ARDUINO_NICLA_VISION/manifest.py @@ -13,6 +13,7 @@ freeze ("$(OMV_LIB_DIR)/", "machine.py") freeze ("$(OMV_LIB_DIR)/", "ml.py") # Networking +require("ssl") require("ntptime") require("webrepl") freeze ("$(OMV_LIB_DIR)/", "rpc.py") diff --git a/src/omv/boards/ARDUINO_NICLA_VISION/omv_boardconfig.h b/src/omv/boards/ARDUINO_NICLA_VISION/omv_boardconfig.h index 26c7d7b0d..d2a7a405c 100644 --- a/src/omv/boards/ARDUINO_NICLA_VISION/omv_boardconfig.h +++ b/src/omv/boards/ARDUINO_NICLA_VISION/omv_boardconfig.h @@ -111,10 +111,12 @@ #define OMV_DMA_MEMORY SRAM2 // DMA buffers memory. #define OMV_DMA_MEMORY_D1 AXI_SRAM // Domain 1 DMA buffers. #define OMV_DMA_MEMORY_D2 SRAM2 // Domain 2 DMA buffers. +#define OMV_CM4_BOOT_MEMORY SRAM4 // Use to boot CM4 for low-power mode. +#define OMV_CM4_BOOT_SIZE 1K #define OMV_GC_BLOCK0_MEMORY DTCM // Main GC block 0. #define OMV_GC_BLOCK0_SIZE (32K) #define OMV_GC_BLOCK1_MEMORY SRAM4 // Extra GC block 1. -#define OMV_GC_BLOCK1_SIZE (64K) +#define OMV_GC_BLOCK1_SIZE (63K) #define OMV_GC_BLOCK2_MEMORY SRAM1 // Extra GC block 2. #define OMV_GC_BLOCK2_SIZE (276K) #define OMV_MSC_BUF_SIZE (2K) // USB MSC bot data @@ -136,8 +138,6 @@ #define OMV_SRAM4_LENGTH 64K #define OMV_AXI_SRAM_ORIGIN 0x24000000 #define OMV_AXI_SRAM_LENGTH 512K -#define OMV_CM4_RAM_ORIGIN 0x38000000 // Cortex-M4 memory @SRAM4. -#define OMV_CM4_RAM_LENGTH 16K // Flash configuration. #define OMV_FLASH_FFS_ORIGIN 0x08020000 @@ -146,8 +146,6 @@ #define OMV_FLASH_TXT_LENGTH 1792K #define OMV_FLASH_EXT_ORIGIN 0x90000000 #define OMV_FLASH_EXT_LENGTH 16M -#define OMV_CM4_FLASH_ORIGIN 0x08020000 -#define OMV_CM4_FLASH_LENGTH 128K // MDMA configuration #define OMV_MDMA_CHANNEL_DCMI_0 (0) diff --git a/src/omv/boards/ARDUINO_NICLA_VISION/ulab_config.h b/src/omv/boards/ARDUINO_NICLA_VISION/ulab_config.h index f537919e7..f0b8e0c17 100644 --- a/src/omv/boards/ARDUINO_NICLA_VISION/ulab_config.h +++ b/src/omv/boards/ARDUINO_NICLA_VISION/ulab_config.h @@ -11,8 +11,7 @@ #ifndef __ULAB_CONFIG_H__ #define __ULAB_CONFIG_H__ // Override ulab defaults here. -#define NDARRAY_BINARY_USES_FUN_POINTER (1) -#define ULAB_VECTORISE_USES_FUN_POINTER (1) -#define ULAB_SCIPY_HAS_OPTIMIZE_MODULE (1) +#define ULAB_SUPPORTS_COMPLEX (0) #define ULAB_SCIPY_HAS_SPECIAL_MODULE (0) +#define NDARRAY_BINARY_USES_FUN_POINTER (1) #endif //__ULAB_CONFIG_H__ diff --git a/src/omv/boards/ARDUINO_PORTENTA_H7/manifest.py b/src/omv/boards/ARDUINO_PORTENTA_H7/manifest.py index b1f6f9907..3d8aba416 100644 --- a/src/omv/boards/ARDUINO_PORTENTA_H7/manifest.py +++ b/src/omv/boards/ARDUINO_PORTENTA_H7/manifest.py @@ -17,6 +17,7 @@ freeze ("$(OMV_LIB_DIR)/", "display.py") freeze ("$(OMV_LIB_DIR)/", "ml.py") # Networking +require("ssl") require("ntptime") require("webrepl") freeze ("$(OMV_LIB_DIR)/", "rpc.py") diff --git a/src/omv/boards/ARDUINO_PORTENTA_H7/omv_boardconfig.h b/src/omv/boards/ARDUINO_PORTENTA_H7/omv_boardconfig.h index 6c73dd477..617acbfb8 100644 --- a/src/omv/boards/ARDUINO_PORTENTA_H7/omv_boardconfig.h +++ b/src/omv/boards/ARDUINO_PORTENTA_H7/omv_boardconfig.h @@ -148,10 +148,6 @@ #define OMV_AXI_SRAM_LENGTH 512K #define OMV_DRAM_ORIGIN 0xC0000000 #define OMV_DRAM_LENGTH 8M -#define OMV_CM4_RAM_ORIGIN 0x30044000 // Cortex-M4 memory. -#define OMV_CM4_RAM_LENGTH 16K -#define OMV_CM4_FLASH_ORIGIN 0x08020000 -#define OMV_CM4_FLASH_LENGTH 128K // Flash configuration. #define OMV_FLASH_FFS_ORIGIN 0x08020000 diff --git a/src/omv/boards/ARDUINO_PORTENTA_H7/ulab_config.h b/src/omv/boards/ARDUINO_PORTENTA_H7/ulab_config.h index 5355426dd..e47e0f0ee 100644 --- a/src/omv/boards/ARDUINO_PORTENTA_H7/ulab_config.h +++ b/src/omv/boards/ARDUINO_PORTENTA_H7/ulab_config.h @@ -9,8 +9,8 @@ #ifndef __ULAB_CONFIG_H__ #define __ULAB_CONFIG_H__ // Override ulab defaults here. +#define ULAB_SUPPORTS_COMPLEX (0) #define NDARRAY_BINARY_USES_FUN_POINTER (1) -#define ULAB_VECTORISE_USES_FUN_POINTER (1) #define ULAB_SCIPY_HAS_OPTIMIZE_MODULE (1) #define ULAB_SCIPY_HAS_SPECIAL_MODULE (0) #endif //__ULAB_CONFIG_H__ diff --git a/src/omv/boards/OPENMV3/ulab_config.h b/src/omv/boards/OPENMV3/ulab_config.h index 21f758a2f..e47e0f0ee 100644 --- a/src/omv/boards/OPENMV3/ulab_config.h +++ b/src/omv/boards/OPENMV3/ulab_config.h @@ -9,4 +9,8 @@ #ifndef __ULAB_CONFIG_H__ #define __ULAB_CONFIG_H__ // Override ulab defaults here. +#define ULAB_SUPPORTS_COMPLEX (0) +#define NDARRAY_BINARY_USES_FUN_POINTER (1) +#define ULAB_SCIPY_HAS_OPTIMIZE_MODULE (1) +#define ULAB_SCIPY_HAS_SPECIAL_MODULE (0) #endif //__ULAB_CONFIG_H__ diff --git a/src/omv/boards/OPENMV4/manifest.py b/src/omv/boards/OPENMV4/manifest.py index b467f13e5..c6c9e4d9d 100644 --- a/src/omv/boards/OPENMV4/manifest.py +++ b/src/omv/boards/OPENMV4/manifest.py @@ -16,6 +16,7 @@ freeze ("$(OMV_LIB_DIR)/", "display.py") freeze ("$(OMV_LIB_DIR)/", "ml.py") # Networking +require("ssl") require("ntptime") require("webrepl") freeze ("$(OMV_LIB_DIR)/", "rpc.py") diff --git a/src/omv/boards/OPENMV4/ulab_config.h b/src/omv/boards/OPENMV4/ulab_config.h index 21f758a2f..cc5f96042 100644 --- a/src/omv/boards/OPENMV4/ulab_config.h +++ b/src/omv/boards/OPENMV4/ulab_config.h @@ -9,4 +9,7 @@ #ifndef __ULAB_CONFIG_H__ #define __ULAB_CONFIG_H__ // Override ulab defaults here. +#define ULAB_SUPPORTS_COMPLEX (0) +#define ULAB_SCIPY_HAS_OPTIMIZE_MODULE (1) +#define ULAB_SCIPY_HAS_SPECIAL_MODULE (0) #endif //__ULAB_CONFIG_H__ diff --git a/src/omv/boards/OPENMV4P/manifest.py b/src/omv/boards/OPENMV4P/manifest.py index b467f13e5..c6c9e4d9d 100644 --- a/src/omv/boards/OPENMV4P/manifest.py +++ b/src/omv/boards/OPENMV4P/manifest.py @@ -16,6 +16,7 @@ freeze ("$(OMV_LIB_DIR)/", "display.py") freeze ("$(OMV_LIB_DIR)/", "ml.py") # Networking +require("ssl") require("ntptime") require("webrepl") freeze ("$(OMV_LIB_DIR)/", "rpc.py") diff --git a/src/omv/boards/OPENMV4P/ulab_config.h b/src/omv/boards/OPENMV4P/ulab_config.h index 21f758a2f..cc5f96042 100644 --- a/src/omv/boards/OPENMV4P/ulab_config.h +++ b/src/omv/boards/OPENMV4P/ulab_config.h @@ -9,4 +9,7 @@ #ifndef __ULAB_CONFIG_H__ #define __ULAB_CONFIG_H__ // Override ulab defaults here. +#define ULAB_SUPPORTS_COMPLEX (0) +#define ULAB_SCIPY_HAS_OPTIMIZE_MODULE (1) +#define ULAB_SCIPY_HAS_SPECIAL_MODULE (0) #endif //__ULAB_CONFIG_H__ diff --git a/src/omv/boards/OPENMV4_PRO/manifest.py b/src/omv/boards/OPENMV4_PRO/manifest.py index bef018cbb..b9fdd2856 100644 --- a/src/omv/boards/OPENMV4_PRO/manifest.py +++ b/src/omv/boards/OPENMV4_PRO/manifest.py @@ -15,6 +15,7 @@ freeze ("$(OMV_LIB_DIR)/", "machine.py") freeze ("$(OMV_LIB_DIR)/", "display.py") # Networking +require("ssl") require("ntptime") require("webrepl") freeze ("$(OMV_LIB_DIR)/", "rpc.py") diff --git a/src/omv/boards/OPENMV4_PRO/ulab_config.h b/src/omv/boards/OPENMV4_PRO/ulab_config.h index 21f758a2f..cc5f96042 100644 --- a/src/omv/boards/OPENMV4_PRO/ulab_config.h +++ b/src/omv/boards/OPENMV4_PRO/ulab_config.h @@ -9,4 +9,7 @@ #ifndef __ULAB_CONFIG_H__ #define __ULAB_CONFIG_H__ // Override ulab defaults here. +#define ULAB_SUPPORTS_COMPLEX (0) +#define ULAB_SCIPY_HAS_OPTIMIZE_MODULE (1) +#define ULAB_SCIPY_HAS_SPECIAL_MODULE (0) #endif //__ULAB_CONFIG_H__ diff --git a/src/omv/boards/OPENMVPT/manifest.py b/src/omv/boards/OPENMVPT/manifest.py index b467f13e5..c6c9e4d9d 100644 --- a/src/omv/boards/OPENMVPT/manifest.py +++ b/src/omv/boards/OPENMVPT/manifest.py @@ -16,6 +16,7 @@ freeze ("$(OMV_LIB_DIR)/", "display.py") freeze ("$(OMV_LIB_DIR)/", "ml.py") # Networking +require("ssl") require("ntptime") require("webrepl") freeze ("$(OMV_LIB_DIR)/", "rpc.py") diff --git a/src/omv/boards/OPENMVPT/ulab_config.h b/src/omv/boards/OPENMVPT/ulab_config.h index 21f758a2f..cc5f96042 100644 --- a/src/omv/boards/OPENMVPT/ulab_config.h +++ b/src/omv/boards/OPENMVPT/ulab_config.h @@ -9,4 +9,7 @@ #ifndef __ULAB_CONFIG_H__ #define __ULAB_CONFIG_H__ // Override ulab defaults here. +#define ULAB_SUPPORTS_COMPLEX (0) +#define ULAB_SCIPY_HAS_OPTIMIZE_MODULE (1) +#define ULAB_SCIPY_HAS_SPECIAL_MODULE (0) #endif //__ULAB_CONFIG_H__ diff --git a/src/omv/boards/OPENMV_RT1060/manifest.py b/src/omv/boards/OPENMV_RT1060/manifest.py index 82ec53bab..78af2d849 100644 --- a/src/omv/boards/OPENMV_RT1060/manifest.py +++ b/src/omv/boards/OPENMV_RT1060/manifest.py @@ -16,6 +16,7 @@ freeze ("$(OMV_LIB_DIR)/", "display.py") freeze ("$(OMV_LIB_DIR)/", "ml.py") # Networking +require("ssl") require("ntptime") require("webrepl") freeze ("$(OMV_LIB_DIR)/", "rpc.py") diff --git a/src/omv/boards/OPENMV_RT1060/ulab_config.h b/src/omv/boards/OPENMV_RT1060/ulab_config.h index 21f758a2f..4c70739e7 100644 --- a/src/omv/boards/OPENMV_RT1060/ulab_config.h +++ b/src/omv/boards/OPENMV_RT1060/ulab_config.h @@ -9,4 +9,7 @@ #ifndef __ULAB_CONFIG_H__ #define __ULAB_CONFIG_H__ // Override ulab defaults here. +#define ULAB_MAX_DIMS (4) +#define ULAB_SUPPORTS_COMPLEX (0) +#define ULAB_SCIPY_HAS_OPTIMIZE_MODULE (1) #endif //__ULAB_CONFIG_H__ diff --git a/src/omv/boards/PICO/manifest.py b/src/omv/boards/PICO/manifest.py index 91b729206..f934dd6df 100644 --- a/src/omv/boards/PICO/manifest.py +++ b/src/omv/boards/PICO/manifest.py @@ -1,6 +1,7 @@ include("$(MPY_DIR)/extmod/asyncio") # Networking +require("ssl") require("ntptime") require("webrepl") diff --git a/src/omv/boards/PICO/ulab_config.h b/src/omv/boards/PICO/ulab_config.h index 21f758a2f..a7e8e7711 100644 --- a/src/omv/boards/PICO/ulab_config.h +++ b/src/omv/boards/PICO/ulab_config.h @@ -9,4 +9,8 @@ #ifndef __ULAB_CONFIG_H__ #define __ULAB_CONFIG_H__ // Override ulab defaults here. +#define ULAB_SUPPORTS_COMPLEX (0) +#define NDARRAY_BINARY_USES_FUN_POINTER (1) +#define ULAB_SCIPY_HAS_OPTIMIZE_MODULE (0) +#define ULAB_SCIPY_HAS_SPECIAL_MODULE (0) #endif //__ULAB_CONFIG_H__ diff --git a/src/omv/common/common.ld.S b/src/omv/common/common.ld.S index ebd84dac0..6af3c5a7a 100644 --- a/src/omv/common/common.ld.S +++ b/src/omv/common/common.ld.S @@ -121,6 +121,27 @@ PROVIDE(__stack = __StackTop); } >OMV_VOSPI_MEMORY #endif +/* Open-AMP Shared Memory Region */ +#if defined(OMV_OPENAMP_MEMORY) +.openamp_memory (NOLOAD) : ALIGN(4) +{ + _openamp_shm_region_start = .; + . = . + OMV_OPENAMP_SIZE; + _openamp_shm_region_end = .; +} >OMV_OPENAMP_MEMORY +#endif + +/* Memory for the second core */ +#if defined(OMV_CORE1_MEMORY) +.core1_memory (NOLOAD) : ALIGN(4) +{ + _core1_memory_start = .; + . = . + OMV_CORE1_SIZE; + _core1_memory_end = .; + _core1_memory_end = .; +} >OMV_CORE1_MEMORY +#endif + /* Main framebuffer memory */ #if defined(OMV_FB_MEMORY) .fb_memory (NOLOAD) : diff --git a/src/omv/common/mp_utils.c b/src/omv/common/mp_utils.c index 40b035d90..00f3197f2 100644 --- a/src/omv/common/mp_utils.c +++ b/src/omv/common/mp_utils.c @@ -129,6 +129,11 @@ void mp_init_gc_stack(void *sstack, void *estack, void *heap_start, void *heap_e // chance to recover from limit hit. (Limit is measured in bytes) mp_stack_set_limit(estack - sstack - stack_limit); + #if MICROPY_ENABLE_PYSTACK + static mp_obj_t pystack[384]; + mp_pystack_init(pystack, &pystack[384]); + #endif + // Initialize gc memory. gc_init(heap_start, heap_end); diff --git a/src/omv/common/usbdbg.c b/src/omv/common/usbdbg.c index e03791293..b0628e7ad 100644 --- a/src/omv/common/usbdbg.c +++ b/src/omv/common/usbdbg.c @@ -16,7 +16,6 @@ #include "py/obj.h" #include "py/objstr.h" #include "py/runtime.h" -#include "pendsv.h" #include "imlib.h" #if MICROPY_PY_SENSOR @@ -37,17 +36,10 @@ static volatile bool script_running; static volatile bool irq_enabled; static vstr_t script_buf; -static mp_obj_exception_t ide_exception; -static const MP_DEFINE_STR_OBJ(ide_exception_msg, "IDE interrupt"); -static const mp_rom_obj_tuple_t ide_exception_args_obj = { - {&mp_type_tuple}, 1, {MP_ROM_PTR(&ide_exception_msg)} -}; - -extern void pendsv_nlr_jump(void *val); - // These functions must be implemented in MicroPython CDC driver. extern uint32_t usb_cdc_buf_len(); extern uint32_t usb_cdc_get_buf(uint8_t *buf, uint32_t len); + void __attribute__((weak)) usb_cdc_reset_buffers() { } @@ -59,20 +51,6 @@ void usbdbg_init() { irq_enabled = false; vstr_init(&script_buf, 32); - - // Initialize the IDE exception object. - ide_exception.base.type = &mp_type_Exception; - ide_exception.traceback_alloc = 0; - ide_exception.traceback_len = 0; - ide_exception.traceback_data = NULL; - ide_exception.args = (mp_obj_tuple_t *) &ide_exception_args_obj; -} - -void usbdbg_wait_for_command(uint32_t timeout) { - for (mp_uint_t ticks = mp_hal_ticks_ms(); - irq_enabled && ((mp_hal_ticks_ms() - ticks) < timeout) && (cmd != USBDBG_NONE); ) { - ; - } } bool usbdbg_script_ready() { @@ -108,21 +86,14 @@ static void usbdbg_interrupt_vm(bool ready) { // Set script running flag script_running = ready; - // Disable IDE IRQ (re-enabled by pyexec or main). + // Disable IDE IRQ (re-enabled by pyexec or in main). usbdbg_set_irq_enabled(false); - // Clear interrupt traceback - mp_obj_exception_clear_traceback(&ide_exception); + // Abort the VM. + mp_sched_vm_abort(); - #if (__ARM_ARCH >= 7) - // Remove the BASEPRI masking (if any) - __set_BASEPRI(0); - #endif - - // Interrupt running REPL - // Note: setting pendsv explicitly here because the VM is probably - // waiting in REPL and the soft interrupt flag will not be checked. - pendsv_nlr_jump(&ide_exception); + // When the VM runs again it will raise a KeyboardInterrupt. + mp_sched_keyboard_interrupt(); } bool usbdbg_get_irq_enabled() { diff --git a/src/omv/modules/examplemodule.c b/src/omv/modules/examplemodule.c index 220a6e0d9..05c2a55de 100644 --- a/src/omv/modules/examplemodule.c +++ b/src/omv/modules/examplemodule.c @@ -2,7 +2,7 @@ #include "py/runtime.h" // This is the function which will be called from Python as cexample.add_ints(a, b). -STATIC mp_obj_t example_add_ints(mp_obj_t a_obj, mp_obj_t b_obj) { +static mp_obj_t example_add_ints(mp_obj_t a_obj, mp_obj_t b_obj) { // Extract the ints from the micropython input objects. int a = mp_obj_get_int(a_obj); int b = mp_obj_get_int(b_obj); @@ -11,18 +11,18 @@ STATIC mp_obj_t example_add_ints(mp_obj_t a_obj, mp_obj_t b_obj) { return mp_obj_new_int(a + b); } // Define a Python reference to the function above. -STATIC MP_DEFINE_CONST_FUN_OBJ_2(example_add_ints_obj, example_add_ints); +static MP_DEFINE_CONST_FUN_OBJ_2(example_add_ints_obj, example_add_ints); // Define all properties of the module. // Table entries are key/value pairs of the attribute name (a string) // and the MicroPython object reference. // All identifiers and strings are written as MP_QSTR_xxx and will be // optimized to word-sized integers by the build system (interned strings). -STATIC const mp_rom_map_elem_t example_module_globals_table[] = { +static const mp_rom_map_elem_t example_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cexample) }, { MP_ROM_QSTR(MP_QSTR_add_ints), MP_ROM_PTR(&example_add_ints_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(example_module_globals, example_module_globals_table); +static MP_DEFINE_CONST_DICT(example_module_globals, example_module_globals_table); // Define module object. const mp_obj_module_t example_user_cmodule = { diff --git a/src/omv/modules/py_clock.c b/src/omv/modules/py_clock.c index b2d0d170f..9a1cfba12 100644 --- a/src/omv/modules/py_clock.c +++ b/src/omv/modules/py_clock.c @@ -25,7 +25,7 @@ mp_obj_t py_clock_tick(mp_obj_t clock_obj) { clock->t_start = mp_hal_ticks_ms(); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_clock_tick_obj, py_clock_tick); +static MP_DEFINE_CONST_FUN_OBJ_1(py_clock_tick_obj, py_clock_tick); mp_obj_t py_clock_fps(mp_obj_t clock_obj) { py_clock_obj_t *clock = (py_clock_obj_t *) clock_obj; @@ -34,7 +34,7 @@ mp_obj_t py_clock_fps(mp_obj_t clock_obj) { float fps = 1000.0f / (clock->t_ticks / (float) clock->t_frame); return mp_obj_new_float(fps); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_clock_fps_obj, py_clock_fps); +static MP_DEFINE_CONST_FUN_OBJ_1(py_clock_fps_obj, py_clock_fps); mp_obj_t py_clock_avg(mp_obj_t clock_obj) { py_clock_obj_t *clock = (py_clock_obj_t *) clock_obj; @@ -42,7 +42,7 @@ mp_obj_t py_clock_avg(mp_obj_t clock_obj) { clock->t_ticks += (mp_hal_ticks_ms() - clock->t_start); return mp_obj_new_float(clock->t_ticks / (float) clock->t_frame); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_clock_avg_obj, py_clock_avg); +static MP_DEFINE_CONST_FUN_OBJ_1(py_clock_avg_obj, py_clock_avg); mp_obj_t py_clock_reset(mp_obj_t clock_obj) { py_clock_obj_t *clock = (py_clock_obj_t *) clock_obj; @@ -51,9 +51,9 @@ mp_obj_t py_clock_reset(mp_obj_t clock_obj) { clock->t_frame = 0; return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_clock_reset_obj, py_clock_reset); +static MP_DEFINE_CONST_FUN_OBJ_1(py_clock_reset_obj, py_clock_reset); -STATIC void py_clock_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +static void py_clock_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { py_clock_obj_t *self = self_in; mp_printf(print, "t_start:%d t_ticks:%d t_frame:%d\n", self->t_start, self->t_ticks, self->t_frame); } @@ -68,14 +68,14 @@ mp_obj_t py_clock_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw return MP_OBJ_FROM_PTR(clock); } -STATIC const mp_rom_map_elem_t py_clock_locals_dict_table[] = { +static const mp_rom_map_elem_t py_clock_locals_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_tick), MP_ROM_PTR(&py_clock_tick_obj)}, { MP_OBJ_NEW_QSTR(MP_QSTR_fps), MP_ROM_PTR(&py_clock_fps_obj)}, { MP_OBJ_NEW_QSTR(MP_QSTR_avg), MP_ROM_PTR(&py_clock_avg_obj)}, { MP_OBJ_NEW_QSTR(MP_QSTR_reset), MP_ROM_PTR(&py_clock_reset_obj)}, { NULL, NULL }, }; -STATIC MP_DEFINE_CONST_DICT(py_clock_locals_dict, py_clock_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_clock_locals_dict, py_clock_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( py_clock_type, diff --git a/src/omv/modules/py_display.c b/src/omv/modules/py_display.c index a3564a3fe..8d06926a2 100644 --- a/src/omv/modules/py_display.c +++ b/src/omv/modules/py_display.c @@ -21,49 +21,49 @@ #include "py_image.h" #include "py_display.h" -STATIC mp_obj_t py_display_width(mp_obj_t self_in) { +static mp_obj_t py_display_width(mp_obj_t self_in) { py_display_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->width); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_display_width_obj, py_display_width); +static MP_DEFINE_CONST_FUN_OBJ_1(py_display_width_obj, py_display_width); -STATIC mp_obj_t py_display_height(mp_obj_t self_in) { +static mp_obj_t py_display_height(mp_obj_t self_in) { py_display_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->height); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_display_height_obj, py_display_height); +static MP_DEFINE_CONST_FUN_OBJ_1(py_display_height_obj, py_display_height); -STATIC mp_obj_t py_display_triple_buffer(mp_obj_t self_in) { +static mp_obj_t py_display_triple_buffer(mp_obj_t self_in) { py_display_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->triple_buffer); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_display_triple_buffer_obj, py_display_triple_buffer); +static MP_DEFINE_CONST_FUN_OBJ_1(py_display_triple_buffer_obj, py_display_triple_buffer); -STATIC mp_obj_t py_display_bgr(mp_obj_t self_in) { +static mp_obj_t py_display_bgr(mp_obj_t self_in) { py_display_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->bgr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_display_bgr_obj, py_display_bgr); +static MP_DEFINE_CONST_FUN_OBJ_1(py_display_bgr_obj, py_display_bgr); -STATIC mp_obj_t py_display_byte_swap(mp_obj_t self_in) { +static mp_obj_t py_display_byte_swap(mp_obj_t self_in) { py_display_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->byte_swap); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_display_byte_swap_obj, py_display_byte_swap); +static MP_DEFINE_CONST_FUN_OBJ_1(py_display_byte_swap_obj, py_display_byte_swap); -STATIC mp_obj_t py_display_framesize(mp_obj_t self_in) { +static mp_obj_t py_display_framesize(mp_obj_t self_in) { py_display_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->framesize); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_display_framesize_obj, py_display_framesize); +static MP_DEFINE_CONST_FUN_OBJ_1(py_display_framesize_obj, py_display_framesize); -STATIC mp_obj_t py_display_refresh(mp_obj_t self_in) { +static mp_obj_t py_display_refresh(mp_obj_t self_in) { py_display_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->refresh); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_display_refresh_obj, py_display_refresh); +static MP_DEFINE_CONST_FUN_OBJ_1(py_display_refresh_obj, py_display_refresh); -STATIC mp_obj_t py_display_deinit(mp_obj_t self_in) { +static mp_obj_t py_display_deinit(mp_obj_t self_in) { py_display_obj_t *self = MP_OBJ_TO_PTR(self_in); py_display_p_t *display_p = (py_display_p_t *) MP_OBJ_TYPE_GET_SLOT(self->base.type, protocol); if (display_p->deinit != NULL) { @@ -78,9 +78,9 @@ STATIC mp_obj_t py_display_deinit(mp_obj_t self_in) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_display_deinit_obj, py_display_deinit); +static MP_DEFINE_CONST_FUN_OBJ_1(py_display_deinit_obj, py_display_deinit); -STATIC mp_obj_t py_display_clear(uint n_args, const mp_obj_t *args) { +static mp_obj_t py_display_clear(uint n_args, const mp_obj_t *args) { py_display_obj_t *self = MP_OBJ_TO_PTR(args[0]); bool display_off = (n_args > 1 && mp_obj_get_int(args[1])); py_display_p_t *display_p = (py_display_p_t *) MP_OBJ_TYPE_GET_SLOT(self->base.type, protocol); @@ -89,9 +89,9 @@ STATIC mp_obj_t py_display_clear(uint n_args, const mp_obj_t *args) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_display_clear_obj, 1, 2, py_display_clear); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_display_clear_obj, 1, 2, py_display_clear); -STATIC mp_obj_t py_display_backlight(uint n_args, const mp_obj_t *args) { +static mp_obj_t py_display_backlight(uint n_args, const mp_obj_t *args) { py_display_obj_t *self = MP_OBJ_TO_PTR(args[0]); if (n_args > 1) { uint32_t intensity = mp_obj_get_int(args[1]); @@ -119,9 +119,9 @@ STATIC mp_obj_t py_display_backlight(uint n_args, const mp_obj_t *args) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_display_backlight_obj, 1, 2, py_display_backlight); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_display_backlight_obj, 1, 2, py_display_backlight); -STATIC mp_obj_t py_display_write(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_display_write(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_image, ARG_x, ARG_y, ARG_x_scale, ARG_y_scale, ARG_roi, ARG_channel, ARG_alpha, ARG_color_palette, ARG_alpha_palette, ARG_hint @@ -175,9 +175,9 @@ STATIC mp_obj_t py_display_write(uint n_args, const mp_obj_t *pos_args, mp_map_t return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_display_write_obj, 2, py_display_write); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_display_write_obj, 2, py_display_write); -STATIC mp_obj_t py_display_bus_write(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_display_bus_write(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_cmd, ARG_args, ARG_dcs }; static const mp_arg_t allowed_args[] = { { MP_QSTR_cmd, MP_ARG_INT | MP_ARG_REQUIRED }, @@ -205,9 +205,9 @@ STATIC mp_obj_t py_display_bus_write(uint n_args, const mp_obj_t *pos_args, mp_m } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_display_bus_write_obj, 1, py_display_bus_write); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_display_bus_write_obj, 1, py_display_bus_write); -STATIC mp_obj_t py_display_bus_read(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_display_bus_read(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_cmd, ARG_len, ARG_args, ARG_dcs }; static const mp_arg_t allowed_args[] = { { MP_QSTR_cmd, MP_ARG_INT | MP_ARG_REQUIRED }, @@ -239,9 +239,9 @@ STATIC mp_obj_t py_display_bus_read(uint n_args, const mp_obj_t *pos_args, mp_ma } return MP_OBJ_FROM_PTR(wbuf); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_display_bus_read_obj, 1, py_display_bus_read); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_display_bus_read_obj, 1, py_display_bus_read); -STATIC const mp_rom_map_elem_t py_display_locals_dict_table[] = { +static const mp_rom_map_elem_t py_display_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_display) }, { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&py_display_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&py_display_width_obj) }, @@ -259,7 +259,7 @@ STATIC const mp_rom_map_elem_t py_display_locals_dict_table[] = { }; MP_DEFINE_CONST_DICT(py_display_locals_dict, py_display_locals_dict_table); -STATIC const mp_rom_map_elem_t globals_dict_table[] = { +static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_display) }, { MP_ROM_QSTR(MP_QSTR_QVGA), MP_ROM_INT(DISPLAY_RESOLUTION_QVGA) }, { MP_ROM_QSTR(MP_QSTR_TQVGA), MP_ROM_INT(DISPLAY_RESOLUTION_TQVGA) }, @@ -293,7 +293,7 @@ STATIC const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_DisplayData), MP_ROM_PTR(&py_display_data_type) }, #endif }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t display_module = { .base = { &mp_type_module }, diff --git a/src/omv/modules/py_display_data.c b/src/omv/modules/py_display_data.c index 8c9a4d3a6..4020ffb11 100644 --- a/src/omv/modules/py_display_data.c +++ b/src/omv/modules/py_display_data.c @@ -49,7 +49,7 @@ static void cec_extint_callback(mp_obj_t self_in) { } } -STATIC mp_obj_t py_cec_send_frame(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_cec_send_frame(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_dst_addr, ARG_src_addr, ARG_data }; static const mp_arg_t allowed_args[] = { { MP_QSTR_dst_addr, MP_ARG_REQUIRED | MP_ARG_INT }, @@ -77,9 +77,9 @@ STATIC mp_obj_t py_cec_send_frame(uint n_args, const mp_obj_t *pos_args, mp_map_ } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_cec_send_frame_obj, 4, py_cec_send_frame); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_cec_send_frame_obj, 4, py_cec_send_frame); -STATIC mp_obj_t py_cec_receive_frame(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_cec_receive_frame(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_dst_addr, ARG_timeout }; static const mp_arg_t allowed_args[] = { { MP_QSTR_dst_addr, MP_ARG_REQUIRED | MP_ARG_INT }, @@ -103,9 +103,9 @@ STATIC mp_obj_t py_cec_receive_frame(uint n_args, const mp_obj_t *pos_args, mp_m } return mp_obj_new_tuple(2, (mp_obj_t []) { MP_OBJ_NEW_SMALL_INT(src_addr), frame }); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_cec_receive_frame_obj, 2, py_cec_receive_frame); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_cec_receive_frame_obj, 2, py_cec_receive_frame); -STATIC mp_obj_t py_cec_frame_callback(mp_obj_t self_in, mp_obj_t cb, mp_obj_t dst_addr) { +static mp_obj_t py_cec_frame_callback(mp_obj_t self_in, mp_obj_t cb, mp_obj_t dst_addr) { py_display_data_obj_t *self = MP_OBJ_TO_PTR(self_in); self->cec_callback = cb; @@ -121,7 +121,7 @@ STATIC mp_obj_t py_cec_frame_callback(mp_obj_t self_in, mp_obj_t cb, mp_obj_t ds } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_3(py_cec_frame_callback_obj, py_cec_frame_callback); +static MP_DEFINE_CONST_FUN_OBJ_3(py_cec_frame_callback_obj, py_cec_frame_callback); #endif // OMV_DISPLAY_CEC_ENABLE #if OMV_DISPLAY_DDC_ENABLE @@ -136,7 +136,7 @@ static bool ddc_checksum(uint8_t *data, int long_count) { return !(sum & 0xFF); } -STATIC mp_obj_t py_ddc_display_id(mp_obj_t self_in) { +static mp_obj_t py_ddc_display_id(mp_obj_t self_in) { py_display_data_obj_t *self = MP_OBJ_TO_PTR(self_in); if (mp_machine_soft_i2c_transfer(self->ddc_bus, self->ddc_addr, 1, &((mp_machine_i2c_buf_t) { @@ -174,7 +174,7 @@ STATIC mp_obj_t py_ddc_display_id(mp_obj_t self_in) { mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Failed to get display id data!")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_ddc_display_id_obj, py_ddc_display_id); +static MP_DEFINE_CONST_FUN_OBJ_1(py_ddc_display_id_obj, py_ddc_display_id); #endif // OMV_DISPLAY_DDC_ENABLE mp_obj_t py_display_data_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { @@ -189,8 +189,7 @@ mp_obj_t py_display_data_make_new(const mp_obj_type_t *type, size_t n_args, size mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - py_display_data_obj_t *self = m_new_obj_with_finaliser(py_display_data_obj_t); - self->base.type = &py_display_data_type; + py_display_data_obj_t *self = mp_obj_malloc_with_finaliser(py_display_data_obj_t, &py_display_data_type); #if OMV_DISPLAY_CEC_ENABLE self->cec_enabled = args[ARG_cec].u_bool; @@ -219,7 +218,7 @@ mp_obj_t py_display_data_make_new(const mp_obj_type_t *type, size_t n_args, size return MP_OBJ_FROM_PTR(self); } -STATIC mp_obj_t py_display_data_deinit(mp_obj_t self_in) { +static mp_obj_t py_display_data_deinit(mp_obj_t self_in) { py_display_data_obj_t *self = MP_OBJ_TO_PTR(self_in); #if OMV_DISPLAY_DDC_ENABLE @@ -236,9 +235,9 @@ STATIC mp_obj_t py_display_data_deinit(mp_obj_t self_in) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_display_data_deinit_obj, py_display_data_deinit); +static MP_DEFINE_CONST_FUN_OBJ_1(py_display_data_deinit_obj, py_display_data_deinit); -STATIC const mp_rom_map_elem_t py_display_data_locals_dict_table[] = { +static const mp_rom_map_elem_t py_display_data_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_display_data) }, { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&py_display_data_deinit_obj) }, #if OMV_DISPLAY_DDC_ENABLE diff --git a/src/omv/modules/py_fir.c b/src/omv/modules/py_fir.c index 5d0bc7445..69c47fbf5 100644 --- a/src/omv/modules/py_fir.c +++ b/src/omv/modules/py_fir.c @@ -317,7 +317,7 @@ static mp_obj_t py_fir_deinit() { fir_transposed = false; return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_fir_deinit_obj, py_fir_deinit); +static MP_DEFINE_CONST_FUN_OBJ_0(py_fir_deinit_obj, py_fir_deinit); mp_obj_t py_fir_init(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_type, ARG_refresh, ARG_resolution }; @@ -585,7 +585,7 @@ mp_obj_t py_fir_init(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_fir_init_obj, 0, py_fir_init); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_fir_init_obj, 0, py_fir_init); static mp_obj_t py_fir_type() { if (fir_sensor != FIR_NONE) { @@ -593,7 +593,7 @@ static mp_obj_t py_fir_type() { } mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("FIR sensor is not initialized")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_fir_type_obj, py_fir_type); +static MP_DEFINE_CONST_FUN_OBJ_0(py_fir_type_obj, py_fir_type); static mp_obj_t py_fir_width() { if (fir_sensor != FIR_NONE) { @@ -601,7 +601,7 @@ static mp_obj_t py_fir_width() { } mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("FIR sensor is not initialized")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_fir_width_obj, py_fir_width); +static MP_DEFINE_CONST_FUN_OBJ_0(py_fir_width_obj, py_fir_width); static mp_obj_t py_fir_height() { if (fir_sensor != FIR_NONE) { @@ -609,7 +609,7 @@ static mp_obj_t py_fir_height() { } mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("FIR sensor is not initialized")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_fir_height_obj, py_fir_height); +static MP_DEFINE_CONST_FUN_OBJ_0(py_fir_height_obj, py_fir_height); static mp_obj_t py_fir_refresh() { #if (OMV_FIR_MLX90621_ENABLE == 1) @@ -643,7 +643,7 @@ static mp_obj_t py_fir_refresh() { mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("FIR sensor is not initialized")); } } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_fir_refresh_obj, py_fir_refresh); +static MP_DEFINE_CONST_FUN_OBJ_0(py_fir_refresh_obj, py_fir_refresh); static mp_obj_t py_fir_resolution() { switch (fir_sensor) { @@ -671,7 +671,7 @@ static mp_obj_t py_fir_resolution() { mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("FIR sensor is not initialized")); } } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_fir_resolution_obj, py_fir_resolution); +static MP_DEFINE_CONST_FUN_OBJ_0(py_fir_resolution_obj, py_fir_resolution); #if (OMV_FIR_LEPTON_ENABLE == 1) static mp_obj_t py_fir_radiometric() { @@ -681,7 +681,7 @@ static mp_obj_t py_fir_radiometric() { mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("Operation not supported by this FIR sensor")); } } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_fir_radiometric_obj, py_fir_radiometric); +static MP_DEFINE_CONST_FUN_OBJ_0(py_fir_radiometric_obj, py_fir_radiometric); #if defined(OMV_FIR_LEPTON_VSYNC_PRESENT) static mp_obj_t py_fir_register_vsync_cb(mp_obj_t cb) { @@ -692,7 +692,7 @@ static mp_obj_t py_fir_register_vsync_cb(mp_obj_t cb) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_fir_register_vsync_cb_obj, py_fir_register_vsync_cb); +static MP_DEFINE_CONST_FUN_OBJ_1(py_fir_register_vsync_cb_obj, py_fir_register_vsync_cb); #endif static mp_obj_t py_fir_register_frame_cb(mp_obj_t cb) { @@ -703,7 +703,7 @@ static mp_obj_t py_fir_register_frame_cb(mp_obj_t cb) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_fir_register_frame_cb_obj, py_fir_register_frame_cb); +static MP_DEFINE_CONST_FUN_OBJ_1(py_fir_register_frame_cb_obj, py_fir_register_frame_cb); static mp_obj_t py_fir_get_frame_available() { if (fir_sensor == FIR_LEPTON) { @@ -712,7 +712,7 @@ static mp_obj_t py_fir_get_frame_available() { mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("Operation not supported by this FIR sensor")); } } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_fir_get_frame_available_obj, py_fir_get_frame_available); +static MP_DEFINE_CONST_FUN_OBJ_0(py_fir_get_frame_available_obj, py_fir_get_frame_available); static mp_obj_t py_fir_trigger_ffc(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_timeout }; @@ -731,7 +731,7 @@ static mp_obj_t py_fir_trigger_ffc(uint n_args, const mp_obj_t *pos_args, mp_map } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_fir_trigger_ffc_obj, 0, py_fir_trigger_ffc); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_fir_trigger_ffc_obj, 0, py_fir_trigger_ffc); #endif mp_obj_t py_fir_read_ta() { @@ -795,7 +795,7 @@ mp_obj_t py_fir_read_ta() { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_fir_read_ta_obj, py_fir_read_ta); +static MP_DEFINE_CONST_FUN_OBJ_0(py_fir_read_ta_obj, py_fir_read_ta); mp_obj_t py_fir_read_ir(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_hmirror, ARG_vflip, ARG_transpose, ARG_timeout }; @@ -870,7 +870,7 @@ mp_obj_t py_fir_read_ir(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_fir_read_ir_obj, 0, py_fir_read_ir); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_fir_read_ir_obj, 0, py_fir_read_ir); mp_obj_t py_fir_draw_ir(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { @@ -944,7 +944,7 @@ mp_obj_t py_fir_draw_ir(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args fb_alloc_free_till_mark(); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_fir_draw_ir_obj, 2, py_fir_draw_ir); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_fir_draw_ir_obj, 2, py_fir_draw_ir); mp_obj_t py_fir_snapshot(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { @@ -1096,9 +1096,9 @@ mp_obj_t py_fir_snapshot(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_arg } return py_image_from_struct(&dst_img); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_fir_snapshot_obj, 0, py_fir_snapshot); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_fir_snapshot_obj, 0, py_fir_snapshot); -STATIC const mp_rom_map_elem_t globals_dict_table[] = { +static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_fir) }, #if (OMV_FIR_MLX90621_ENABLE == 1) { MP_ROM_QSTR(MP_QSTR_FIR_SHIELD), MP_ROM_INT(FIR_MLX90621) }, @@ -1146,7 +1146,7 @@ STATIC const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_snapshot), MP_ROM_PTR(&py_fir_snapshot_obj) } }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t fir_module = { .base = { &mp_type_module }, diff --git a/src/omv/modules/py_fir_lepton.c b/src/omv/modules/py_fir_lepton.c index 5af8aac36..777864c99 100644 --- a/src/omv/modules/py_fir_lepton.c +++ b/src/omv/modules/py_fir_lepton.c @@ -69,7 +69,7 @@ static int fir_lepton_spi_rx_cb_expected_sid = 0; static uint16_t OMV_ATTR_SECTION(OMV_ATTR_ALIGNED_DMA(fir_lepton_buf[VOSPI_BUFFER_SIZE]), ".dma_buffer"); static void fir_lepton_spi_callback(omv_spi_t *spi, void *userdata, void *buf); -STATIC mp_obj_t fir_lepton_spi_resync_callback(mp_obj_t unused) { +static mp_obj_t fir_lepton_spi_resync_callback(mp_obj_t unused) { // For triple buffering we are never drawing where tail or head // (which may instantly update to be equal to tail) is. fir_lepton_spi_rx_cb_tail = (framebuffer_tail + 1) % FRAMEBUFFER_COUNT; @@ -88,7 +88,7 @@ STATIC mp_obj_t fir_lepton_spi_resync_callback(mp_obj_t unused) { omv_spi_transfer_start(&spi_bus, &spi_xfer); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(fir_lepton_spi_resync_callback_obj, fir_lepton_spi_resync_callback); +static MP_DEFINE_CONST_FUN_OBJ_1(fir_lepton_spi_resync_callback_obj, fir_lepton_spi_resync_callback); static void fir_lepton_spi_resync() { flir_lepton_spi_rx_timer.flags = SOFT_TIMER_FLAG_PY_CALLBACK; diff --git a/src/omv/modules/py_ft5x06.c b/src/omv/modules/py_ft5x06.c index 6fbb5a4d2..40634e29f 100644 --- a/src/omv/modules/py_ft5x06.c +++ b/src/omv/modules/py_ft5x06.c @@ -56,7 +56,7 @@ typedef struct _py_ft5x06_obj_t { const mp_obj_type_t py_ft5x06_type; -STATIC mp_obj_t py_ft5x06_update_points(mp_obj_t self_in); +static mp_obj_t py_ft5x06_update_points(mp_obj_t self_in); static void ft5x06_extint_callback(mp_obj_t self_in) { py_ft5x06_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -67,19 +67,19 @@ static void ft5x06_extint_callback(mp_obj_t self_in) { } } -STATIC mp_obj_t py_ft5x06_get_gesture(mp_obj_t self_in) { +static mp_obj_t py_ft5x06_get_gesture(mp_obj_t self_in) { py_ft5x06_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->touch_gesture); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_ft5x06_get_gesture_obj, py_ft5x06_get_gesture); +static MP_DEFINE_CONST_FUN_OBJ_1(py_ft5x06_get_gesture_obj, py_ft5x06_get_gesture); -STATIC mp_obj_t py_ft5x06_get_points(mp_obj_t self_in) { +static mp_obj_t py_ft5x06_get_points(mp_obj_t self_in) { py_ft5x06_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->touch_points); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_ft5x06_get_points_obj, py_ft5x06_get_points); +static MP_DEFINE_CONST_FUN_OBJ_1(py_ft5x06_get_points_obj, py_ft5x06_get_points); -STATIC mp_obj_t py_ft5x06_get_point_flag(mp_obj_t self_in, mp_obj_t index) { +static mp_obj_t py_ft5x06_get_point_flag(mp_obj_t self_in, mp_obj_t index) { py_ft5x06_obj_t *self = MP_OBJ_TO_PTR(self_in); int i = mp_obj_get_int(index); @@ -88,9 +88,9 @@ STATIC mp_obj_t py_ft5x06_get_point_flag(mp_obj_t self_in, mp_obj_t index) { } return mp_obj_new_int(self->touch_flag[i]); } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(py_ft5x06_get_point_flag_obj, py_ft5x06_get_point_flag); +static MP_DEFINE_CONST_FUN_OBJ_2(py_ft5x06_get_point_flag_obj, py_ft5x06_get_point_flag); -STATIC mp_obj_t py_ft5x06_get_point_id(mp_obj_t self_in, mp_obj_t index) { +static mp_obj_t py_ft5x06_get_point_id(mp_obj_t self_in, mp_obj_t index) { py_ft5x06_obj_t *self = MP_OBJ_TO_PTR(self_in); int i = mp_obj_get_int(index); @@ -99,9 +99,9 @@ STATIC mp_obj_t py_ft5x06_get_point_id(mp_obj_t self_in, mp_obj_t index) { } return mp_obj_new_int(self->touch_id[i]); } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(py_ft5x06_get_point_id_obj, py_ft5x06_get_point_id); +static MP_DEFINE_CONST_FUN_OBJ_2(py_ft5x06_get_point_id_obj, py_ft5x06_get_point_id); -STATIC mp_obj_t py_ft5x06_get_point_x(mp_obj_t self_in, mp_obj_t index) { +static mp_obj_t py_ft5x06_get_point_x(mp_obj_t self_in, mp_obj_t index) { py_ft5x06_obj_t *self = MP_OBJ_TO_PTR(self_in); int i = mp_obj_get_int(index); @@ -110,9 +110,9 @@ STATIC mp_obj_t py_ft5x06_get_point_x(mp_obj_t self_in, mp_obj_t index) { } return mp_obj_new_int(self->x[i]); } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(py_ft5x06_get_point_x_obj, py_ft5x06_get_point_x); +static MP_DEFINE_CONST_FUN_OBJ_2(py_ft5x06_get_point_x_obj, py_ft5x06_get_point_x); -STATIC mp_obj_t py_ft5x06_get_point_y(mp_obj_t self_in, mp_obj_t index) { +static mp_obj_t py_ft5x06_get_point_y(mp_obj_t self_in, mp_obj_t index) { py_ft5x06_obj_t *self = MP_OBJ_TO_PTR(self_in); int i = mp_obj_get_int(index); @@ -121,9 +121,9 @@ STATIC mp_obj_t py_ft5x06_get_point_y(mp_obj_t self_in, mp_obj_t index) { } return mp_obj_new_int(self->y[i]); } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(py_ft5x06_get_point_y_obj, py_ft5x06_get_point_y); +static MP_DEFINE_CONST_FUN_OBJ_2(py_ft5x06_get_point_y_obj, py_ft5x06_get_point_y); -STATIC mp_obj_t py_ft5x06_callback(mp_obj_t self_in, mp_obj_t cb) { +static mp_obj_t py_ft5x06_callback(mp_obj_t self_in, mp_obj_t cb) { py_ft5x06_obj_t *self = MP_OBJ_TO_PTR(self_in); self->touch_callback = cb; @@ -136,9 +136,9 @@ STATIC mp_obj_t py_ft5x06_callback(mp_obj_t self_in, mp_obj_t cb) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(py_ft5x06_callback_obj, py_ft5x06_callback); +static MP_DEFINE_CONST_FUN_OBJ_2(py_ft5x06_callback_obj, py_ft5x06_callback); -STATIC mp_obj_t py_ft5x06_update_points(mp_obj_t self_in) { +static mp_obj_t py_ft5x06_update_points(mp_obj_t self_in) { py_ft5x06_obj_t *self = MP_OBJ_TO_PTR(self_in); if (mp_machine_soft_i2c_transfer(self->i2c_bus, self->i2c_addr, 1, &((mp_machine_i2c_buf_t) { @@ -189,9 +189,9 @@ STATIC mp_obj_t py_ft5x06_update_points(mp_obj_t self_in) { mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Failed to update the number of touch points!")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_ft5x06_update_points_obj, py_ft5x06_update_points); +static MP_DEFINE_CONST_FUN_OBJ_1(py_ft5x06_update_points_obj, py_ft5x06_update_points); -STATIC mp_obj_t py_ft5x06_deinit(mp_obj_t self_in) { +static mp_obj_t py_ft5x06_deinit(mp_obj_t self_in) { omv_gpio_irq_enable(OMV_FT5X06_INT_PIN, false); omv_gpio_write(OMV_FT5X06_RESET_PIN, 0); @@ -207,7 +207,7 @@ STATIC mp_obj_t py_ft5x06_deinit(mp_obj_t self_in) { HAL_GPIO_DeInit(OMV_FT5X06_SCL_PIN->gpio, OMV_FT5X06_SCL_PIN->pin_mask); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_ft5x06_deinit_obj, py_ft5x06_deinit); +static MP_DEFINE_CONST_FUN_OBJ_1(py_ft5x06_deinit_obj, py_ft5x06_deinit); mp_obj_t py_ft5x06_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_i2c_addr }; @@ -219,8 +219,7 @@ mp_obj_t py_ft5x06_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_k mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - py_ft5x06_obj_t *self = m_new_obj_with_finaliser(py_ft5x06_obj_t); - self->base.type = &py_ft5x06_type; + py_ft5x06_obj_t *self = mp_obj_malloc_with_finaliser(py_ft5x06_obj_t, &py_ft5x06_type); self->i2c_addr = args[ARG_i2c_addr].u_int; self->i2c_bus = MP_OBJ_TYPE_GET_SLOT( &mp_machine_soft_i2c_type, make_new) (&mp_machine_soft_i2c_type, 2, 0, (const mp_obj_t []) { @@ -242,7 +241,7 @@ mp_obj_t py_ft5x06_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_k return MP_OBJ_FROM_PTR(self); } -STATIC const mp_rom_map_elem_t py_ft5x06_locals_dict_table[] = { +static const mp_rom_map_elem_t py_ft5x06_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ft5x06) }, { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&py_ft5x06_deinit_obj) }, @@ -266,7 +265,7 @@ STATIC const mp_rom_map_elem_t py_ft5x06_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_touch_callback), MP_ROM_PTR(&py_ft5x06_callback_obj) }, { MP_ROM_QSTR(MP_QSTR_update_points), MP_ROM_PTR(&py_ft5x06_update_points_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(py_ft5x06_locals_dict, py_ft5x06_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_ft5x06_locals_dict, py_ft5x06_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( py_ft5x06_type, @@ -276,11 +275,11 @@ MP_DEFINE_CONST_OBJ_TYPE( locals_dict, &py_ft5x06_locals_dict ); -STATIC const mp_rom_map_elem_t globals_dict_table[] = { +static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ft5x06) }, { MP_ROM_QSTR(MP_QSTR_FT5X06), MP_ROM_PTR(&py_ft5x06_type) }, }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t ft5x06_module = { .base = { &mp_type_module }, diff --git a/src/omv/modules/py_gif.c b/src/omv/modules/py_gif.c index 46476028b..4a6179528 100644 --- a/src/omv/modules/py_gif.c +++ b/src/omv/modules/py_gif.c @@ -42,31 +42,31 @@ static mp_obj_t py_gif_width(mp_obj_t self_in) { py_gif_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->width); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_gif_width_obj, py_gif_width); +static MP_DEFINE_CONST_FUN_OBJ_1(py_gif_width_obj, py_gif_width); static mp_obj_t py_gif_height(mp_obj_t self_in) { py_gif_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->height); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_gif_height_obj, py_gif_height); +static MP_DEFINE_CONST_FUN_OBJ_1(py_gif_height_obj, py_gif_height); static mp_obj_t py_gif_format(mp_obj_t self_in) { py_gif_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->color ? PIXFORMAT_RGB565 : PIXFORMAT_GRAYSCALE); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_gif_format_obj, py_gif_format); +static MP_DEFINE_CONST_FUN_OBJ_1(py_gif_format_obj, py_gif_format); static mp_obj_t py_gif_size(mp_obj_t self_in) { py_gif_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(file_size(&self->fp)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_gif_size_obj, py_gif_size); +static MP_DEFINE_CONST_FUN_OBJ_1(py_gif_size_obj, py_gif_size); static mp_obj_t py_gif_loop(mp_obj_t self_in) { py_gif_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->loop); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_gif_loop_obj, py_gif_loop); +static MP_DEFINE_CONST_FUN_OBJ_1(py_gif_loop_obj, py_gif_loop); static mp_obj_t py_gif_add_frame(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_delay }; @@ -91,14 +91,14 @@ static mp_obj_t py_gif_add_frame(uint n_args, const mp_obj_t *pos_args, mp_map_t gif_add_frame(&self->fp, image, args[ARG_delay].u_int); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_gif_add_frame_obj, 2, py_gif_add_frame); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_gif_add_frame_obj, 2, py_gif_add_frame); -STATIC mp_obj_t py_gif_close(mp_obj_t self_in) { +static mp_obj_t py_gif_close(mp_obj_t self_in) { py_gif_obj_t *self = MP_OBJ_TO_PTR(self_in); gif_close(&self->fp); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_gif_close_obj, py_gif_close); +static MP_DEFINE_CONST_FUN_OBJ_1(py_gif_close_obj, py_gif_close); static mp_obj_t py_gif_open(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_width, ARG_height, ARG_color, ARG_loop }; @@ -114,8 +114,7 @@ static mp_obj_t py_gif_open(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_ mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - py_gif_obj_t *gif = m_new_obj_with_finaliser(py_gif_obj_t); - gif->base.type = &py_gif_type; + py_gif_obj_t *gif = mp_obj_malloc_with_finaliser(py_gif_obj_t, &py_gif_type); gif->width = (args[ARG_width].u_int == -1) ? framebuffer_get_width() : args[ARG_width].u_int; gif->height = (args[ARG_height].u_int == -1) ? framebuffer_get_height() : args[ARG_height].u_int; gif->color = (args[ARG_color].u_int == -1) ? (framebuffer_get_depth() >= 2) : args[ARG_color].u_bool; @@ -125,9 +124,9 @@ static mp_obj_t py_gif_open(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_ gif_open(&gif->fp, gif->width, gif->height, gif->color, gif->loop); return gif; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_gif_open_obj, 1, py_gif_open); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_gif_open_obj, 1, py_gif_open); -STATIC const mp_rom_map_elem_t py_gif_locals_dict_table[] = { +static const mp_rom_map_elem_t py_gif_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_gif) }, { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&py_gif_close_obj) }, @@ -140,9 +139,9 @@ STATIC const mp_rom_map_elem_t py_gif_locals_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_close), MP_ROM_PTR(&py_gif_close_obj) }, { NULL, NULL }, }; -STATIC MP_DEFINE_CONST_DICT(py_gif_locals_dict, py_gif_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_gif_locals_dict, py_gif_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_gif_type, MP_QSTR_Gif, MP_TYPE_FLAG_NONE, @@ -150,12 +149,12 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE( locals_dict, &py_gif_locals_dict ); -STATIC const mp_rom_map_elem_t globals_dict_table[] = { +static const mp_rom_map_elem_t globals_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_gif) }, { MP_OBJ_NEW_QSTR(MP_QSTR_Gif), MP_ROM_PTR(&py_gif_open_obj) }, { NULL, NULL }, }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t gif_module = { .base = { &mp_type_module }, diff --git a/src/omv/modules/py_image.c b/src/omv/modules/py_image.c index 5a2a023a1..b263e3f59 100644 --- a/src/omv/modules/py_image.c +++ b/src/omv/modules/py_image.c @@ -63,7 +63,7 @@ static void py_cascade_print(const mp_print_t *print, mp_obj_t self_in, mp_print self->_cobj.n_features, self->_cobj.n_rectangles); } -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_cascade_type, MP_QSTR_Cascade, MP_TYPE_FLAG_NONE, @@ -119,7 +119,7 @@ static mp_obj_t py_kp_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { return MP_OBJ_NULL; // op not supported } -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_kp_type, MP_QSTR_kp_desc, MP_TYPE_FLAG_NONE, @@ -148,7 +148,7 @@ static void py_lbp_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kin mp_printf(print, "{}"); } -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_lbp_type, MP_QSTR_lbp_desc, MP_TYPE_FLAG_NONE, @@ -208,47 +208,47 @@ static mp_obj_t py_kptmatch_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t va mp_obj_t py_kptmatch_cx(mp_obj_t self_in) { return ((py_kptmatch_obj_t *) self_in)->cx; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_cx_obj, py_kptmatch_cx); +static MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_cx_obj, py_kptmatch_cx); mp_obj_t py_kptmatch_cy(mp_obj_t self_in) { return ((py_kptmatch_obj_t *) self_in)->cy; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_cy_obj, py_kptmatch_cy); +static MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_cy_obj, py_kptmatch_cy); mp_obj_t py_kptmatch_x(mp_obj_t self_in) { return ((py_kptmatch_obj_t *) self_in)->x; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_x_obj, py_kptmatch_x); +static MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_x_obj, py_kptmatch_x); mp_obj_t py_kptmatch_y(mp_obj_t self_in) { return ((py_kptmatch_obj_t *) self_in)->y; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_y_obj, py_kptmatch_y); +static MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_y_obj, py_kptmatch_y); mp_obj_t py_kptmatch_w(mp_obj_t self_in) { return ((py_kptmatch_obj_t *) self_in)->w; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_w_obj, py_kptmatch_w); +static MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_w_obj, py_kptmatch_w); mp_obj_t py_kptmatch_h(mp_obj_t self_in) { return ((py_kptmatch_obj_t *) self_in)->h; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_h_obj, py_kptmatch_h); +static MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_h_obj, py_kptmatch_h); mp_obj_t py_kptmatch_count(mp_obj_t self_in) { return ((py_kptmatch_obj_t *) self_in)->count; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_count_obj, py_kptmatch_count); +static MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_count_obj, py_kptmatch_count); mp_obj_t py_kptmatch_theta(mp_obj_t self_in) { return ((py_kptmatch_obj_t *) self_in)->theta; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_theta_obj, py_kptmatch_theta); +static MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_theta_obj, py_kptmatch_theta); mp_obj_t py_kptmatch_match(mp_obj_t self_in) { return ((py_kptmatch_obj_t *) self_in)->match; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_match_obj, py_kptmatch_match); +static MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_match_obj, py_kptmatch_match); mp_obj_t py_kptmatch_rect(mp_obj_t self_in) { return mp_obj_new_tuple(4, (mp_obj_t []) {((py_kptmatch_obj_t *) self_in)->x, @@ -256,9 +256,9 @@ mp_obj_t py_kptmatch_rect(mp_obj_t self_in) { ((py_kptmatch_obj_t *) self_in)->w, ((py_kptmatch_obj_t *) self_in)->h}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_rect_obj, py_kptmatch_rect); +static MP_DEFINE_CONST_FUN_OBJ_1(py_kptmatch_rect_obj, py_kptmatch_rect); -STATIC const mp_rom_map_elem_t py_kptmatch_locals_dict_table[] = { +static const mp_rom_map_elem_t py_kptmatch_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_cx), MP_ROM_PTR(&py_kptmatch_cx_obj) }, { MP_ROM_QSTR(MP_QSTR_cy), MP_ROM_PTR(&py_kptmatch_cy_obj) }, { MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&py_kptmatch_x_obj) }, @@ -271,9 +271,9 @@ STATIC const mp_rom_map_elem_t py_kptmatch_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_rect), MP_ROM_PTR(&py_kptmatch_rect_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_kptmatch_locals_dict, py_kptmatch_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_kptmatch_locals_dict, py_kptmatch_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_kptmatch_type, MP_QSTR_kptmatch, MP_TYPE_FLAG_NONE, @@ -323,7 +323,7 @@ mp_obj_t py_image_unary_op(mp_unary_op_t op, mp_obj_t self_in) { } // image iterator -STATIC mp_obj_t py_image_it_iternext(mp_obj_t self_in) { +static mp_obj_t py_image_it_iternext(mp_obj_t self_in) { mp_obj_py_image_it_t *self = MP_OBJ_TO_PTR(self_in); py_image_obj_t *image = MP_OBJ_TO_PTR(self->py_image); image_t *img = &image->_cobj; @@ -377,7 +377,7 @@ STATIC mp_obj_t py_image_it_iternext(mp_obj_t self_in) { } } -STATIC mp_obj_t py_image_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf) { +static mp_obj_t py_image_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf) { assert(sizeof(mp_obj_py_image_it_t) <= sizeof(mp_obj_iter_buf_t)); mp_obj_py_image_it_t *o = (mp_obj_py_image_it_t *) iter_buf; o->base.type = &mp_type_polymorph_iter; @@ -683,12 +683,12 @@ static mp_int_t py_image_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, static mp_obj_t py_image_width(mp_obj_t img_obj) { return mp_obj_new_int(((image_t *) py_image_cobj(img_obj))->w); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_width_obj, py_image_width); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_width_obj, py_image_width); static mp_obj_t py_image_height(mp_obj_t img_obj) { return mp_obj_new_int(((image_t *) py_image_cobj(img_obj))->h); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_height_obj, py_image_height); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_height_obj, py_image_height); static mp_obj_t py_image_format(mp_obj_t img_obj) { image_t *image = py_image_cobj(img_obj); @@ -711,20 +711,20 @@ static mp_obj_t py_image_format(mp_obj_t img_obj) { return mp_obj_new_int(PIXFORMAT_INVALID); } } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_format_obj, py_image_format); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_format_obj, py_image_format); static mp_obj_t py_image_size(mp_obj_t img_obj) { return mp_obj_new_int(image_size((image_t *) py_image_cobj(img_obj))); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_size_obj, py_image_size); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_size_obj, py_image_size); static mp_obj_t py_image_bytearray(mp_obj_t img_obj) { image_t *arg_img = (image_t *) py_image_cobj(img_obj); return mp_obj_new_bytearray_by_ref(image_size(arg_img), arg_img->data); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_bytearray_obj, py_image_bytearray); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_bytearray_obj, py_image_bytearray); -STATIC mp_obj_t py_image_get_pixel(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_get_pixel(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_UNCOMPRESSED); const mp_obj_t *arg_vec; @@ -801,9 +801,9 @@ STATIC mp_obj_t py_image_get_pixel(uint n_args, const mp_obj_t *args, mp_map_t * default: return mp_const_none; } } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_get_pixel_obj, 2, py_image_get_pixel); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_get_pixel_obj, 2, py_image_get_pixel); -STATIC mp_obj_t py_image_set_pixel(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_set_pixel(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_UNCOMPRESSED); const mp_obj_t *arg_vec; @@ -838,7 +838,7 @@ STATIC mp_obj_t py_image_set_pixel(uint n_args, const mp_obj_t *args, mp_map_t * default: return args[0]; } } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_set_pixel_obj, 2, py_image_set_pixel); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_set_pixel_obj, 2, py_image_set_pixel); static mp_obj_t py_image_to(pixformat_t pixfmt, mp_rom_obj_t default_color_palette, bool default_copy, uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -1033,47 +1033,47 @@ static mp_obj_t py_image_to(pixformat_t pixfmt, mp_rom_obj_t default_color_palet static mp_obj_t py_image_to_bitmap(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { return py_image_to(PIXFORMAT_BINARY, MP_ROM_NONE, false, n_args, args, kw_args); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_bitmap_obj, 1, py_image_to_bitmap); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_bitmap_obj, 1, py_image_to_bitmap); static mp_obj_t py_image_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { return py_image_to(PIXFORMAT_GRAYSCALE, MP_ROM_NONE, false, n_args, args, kw_args); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_grayscale_obj, 1, py_image_to_grayscale); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_grayscale_obj, 1, py_image_to_grayscale); static mp_obj_t py_image_to_rgb565(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { return py_image_to(PIXFORMAT_RGB565, MP_ROM_NONE, false, n_args, args, kw_args); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_rgb565_obj, 1, py_image_to_rgb565); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_rgb565_obj, 1, py_image_to_rgb565); static mp_obj_t py_image_to_rainbow(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { return py_image_to(PIXFORMAT_RGB565, MP_ROM_INT(COLOR_PALETTE_RAINBOW), false, n_args, args, kw_args); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_rainbow_obj, 1, py_image_to_rainbow); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_rainbow_obj, 1, py_image_to_rainbow); static mp_obj_t py_image_to_ironbow(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { return py_image_to(PIXFORMAT_RGB565, MP_ROM_INT(COLOR_PALETTE_IRONBOW), false, n_args, args, kw_args); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_ironbow_obj, 1, py_image_to_ironbow); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_ironbow_obj, 1, py_image_to_ironbow); static mp_obj_t py_image_to_jpeg(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { return py_image_to(PIXFORMAT_JPEG, MP_ROM_NONE, false, n_args, args, kw_args); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_jpeg_obj, 1, py_image_to_jpeg); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_jpeg_obj, 1, py_image_to_jpeg); static mp_obj_t py_image_to_png(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { return py_image_to(PIXFORMAT_PNG, MP_ROM_NONE, false, n_args, args, kw_args); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_png_obj, 1, py_image_to_png); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_to_png_obj, 1, py_image_to_png); static mp_obj_t py_image_copy(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { return py_image_to(PIXFORMAT_INVALID, MP_ROM_NONE, true, n_args, args, kw_args); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_copy_obj, 1, py_image_copy); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_copy_obj, 1, py_image_copy); static mp_obj_t py_image_crop(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { return py_image_to(PIXFORMAT_INVALID, MP_ROM_NONE, false, n_args, args, kw_args); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_crop_obj, 1, py_image_crop); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_crop_obj, 1, py_image_crop); #if defined(IMLIB_ENABLE_IMAGE_FILE_IO) static mp_obj_t py_image_save(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { @@ -1091,20 +1091,20 @@ static mp_obj_t py_image_save(uint n_args, const mp_obj_t *args, mp_map_t *kw_ar fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_save_obj, 2, py_image_save); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_save_obj, 2, py_image_save); #endif //IMLIB_ENABLE_IMAGE_FILE_IO static mp_obj_t py_image_flush(mp_obj_t img_obj) { framebuffer_update_jpeg_buffer(); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_flush_obj, py_image_flush); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_flush_obj, py_image_flush); ////////////////// // Drawing Methods ////////////////// -STATIC mp_obj_t py_image_clear(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_clear(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_UNCOMPRESSED); image_t *arg_msk = @@ -1118,9 +1118,9 @@ STATIC mp_obj_t py_image_clear(uint n_args, const mp_obj_t *args, mp_map_t *kw_a return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_clear_obj, 1, py_image_clear); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_clear_obj, 1, py_image_clear); -STATIC mp_obj_t py_image_draw_line(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_draw_line(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); const mp_obj_t *arg_vec; @@ -1138,9 +1138,9 @@ STATIC mp_obj_t py_image_draw_line(uint n_args, const mp_obj_t *args, mp_map_t * imlib_draw_line(arg_img, arg_x0, arg_y0, arg_x1, arg_y1, arg_c, arg_thickness); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_line_obj, 2, py_image_draw_line); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_line_obj, 2, py_image_draw_line); -STATIC mp_obj_t py_image_draw_rectangle(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_draw_rectangle(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); const mp_obj_t *arg_vec; @@ -1160,9 +1160,9 @@ STATIC mp_obj_t py_image_draw_rectangle(uint n_args, const mp_obj_t *args, mp_ma imlib_draw_rectangle(arg_img, arg_rx, arg_ry, arg_rw, arg_rh, arg_c, arg_thickness, arg_fill); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_rectangle_obj, 2, py_image_draw_rectangle); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_rectangle_obj, 2, py_image_draw_rectangle); -STATIC mp_obj_t py_image_draw_circle(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_draw_circle(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); const mp_obj_t *arg_vec; @@ -1181,9 +1181,9 @@ STATIC mp_obj_t py_image_draw_circle(uint n_args, const mp_obj_t *args, mp_map_t imlib_draw_circle(arg_img, arg_cx, arg_cy, arg_cr, arg_c, arg_thickness, arg_fill); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_circle_obj, 2, py_image_draw_circle); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_circle_obj, 2, py_image_draw_circle); -STATIC mp_obj_t py_image_draw_ellipse(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_draw_ellipse(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); const mp_obj_t *arg_vec; @@ -1204,9 +1204,9 @@ STATIC mp_obj_t py_image_draw_ellipse(uint n_args, const mp_obj_t *args, mp_map_ imlib_draw_ellipse(arg_img, arg_cx, arg_cy, arg_rx, arg_ry, arg_r, arg_c, arg_thickness, arg_fill); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_ellipse_obj, 2, py_image_draw_ellipse); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_ellipse_obj, 2, py_image_draw_ellipse); -STATIC mp_obj_t py_image_draw_string(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_draw_string(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); const mp_obj_t *arg_vec; @@ -1245,9 +1245,9 @@ STATIC mp_obj_t py_image_draw_string(uint n_args, const mp_obj_t *args, mp_map_t arg_string_rotation, arg_string_hmirror, arg_string_vflip); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_string_obj, 2, py_image_draw_string); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_string_obj, 2, py_image_draw_string); -STATIC mp_obj_t py_image_draw_cross(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_draw_cross(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); const mp_obj_t *arg_vec; @@ -1266,9 +1266,9 @@ STATIC mp_obj_t py_image_draw_cross(uint n_args, const mp_obj_t *args, mp_map_t imlib_draw_line(arg_img, arg_x, arg_y - arg_s, arg_x, arg_y + arg_s, arg_c, arg_thickness); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_cross_obj, 2, py_image_draw_cross); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_cross_obj, 2, py_image_draw_cross); -STATIC mp_obj_t py_image_draw_arrow(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_draw_arrow(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); const mp_obj_t *arg_vec; @@ -1304,9 +1304,9 @@ STATIC mp_obj_t py_image_draw_arrow(uint n_args, const mp_obj_t *args, mp_map_t imlib_draw_line(arg_img, arg_x1, arg_y1, a1x, a1y, arg_c, arg_thickness); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_arrow_obj, 2, py_image_draw_arrow); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_arrow_obj, 2, py_image_draw_arrow); -STATIC mp_obj_t py_image_draw_edges(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_draw_edges(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); mp_obj_t *corners, *p0, *p1, *p2, *p3; @@ -1349,9 +1349,9 @@ STATIC mp_obj_t py_image_draw_edges(uint n_args, const mp_obj_t *args, mp_map_t return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_edges_obj, 2, py_image_draw_edges); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_edges_obj, 2, py_image_draw_edges); -STATIC mp_obj_t py_image_draw_image(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_draw_image(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { fb_alloc_mark(); image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); image_t *arg_other = py_helper_arg_to_image(args[1], ARG_IMAGE_ANY | ARG_IMAGE_ALLOC); @@ -1437,9 +1437,9 @@ STATIC mp_obj_t py_image_draw_image(uint n_args, const mp_obj_t *args, mp_map_t fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_image_obj, 3, py_image_draw_image); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_image_obj, 3, py_image_draw_image); -STATIC mp_obj_t py_image_draw_keypoints(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_draw_keypoints(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); int arg_c = @@ -1486,9 +1486,9 @@ STATIC mp_obj_t py_image_draw_keypoints(uint n_args, const mp_obj_t *args, mp_ma return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_keypoints_obj, 2, py_image_draw_keypoints); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_draw_keypoints_obj, 2, py_image_draw_keypoints); -STATIC mp_obj_t py_image_mask_rectangle(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_mask_rectangle(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); int arg_rx; int arg_ry; @@ -1522,9 +1522,9 @@ STATIC mp_obj_t py_image_mask_rectangle(uint n_args, const mp_obj_t *args, mp_ma fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mask_rectangle_obj, 1, py_image_mask_rectangle); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mask_rectangle_obj, 1, py_image_mask_rectangle); -STATIC mp_obj_t py_image_mask_circle(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_mask_circle(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); int arg_cx; int arg_cy; @@ -1555,9 +1555,9 @@ STATIC mp_obj_t py_image_mask_circle(uint n_args, const mp_obj_t *args, mp_map_t fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mask_circle_obj, 1, py_image_mask_circle); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mask_circle_obj, 1, py_image_mask_circle); -STATIC mp_obj_t py_image_mask_ellipse(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_mask_ellipse(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); int arg_cx; int arg_cy; @@ -1594,10 +1594,10 @@ STATIC mp_obj_t py_image_mask_ellipse(uint n_args, const mp_obj_t *args, mp_map_ fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mask_ellipse_obj, 1, py_image_mask_ellipse); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mask_ellipse_obj, 1, py_image_mask_ellipse); #ifdef IMLIB_ENABLE_FLOOD_FILL -STATIC mp_obj_t py_image_flood_fill(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_flood_fill(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); const mp_obj_t *arg_vec; @@ -1629,7 +1629,7 @@ STATIC mp_obj_t py_image_flood_fill(uint n_args, const mp_obj_t *args, mp_map_t fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_flood_fill_obj, 2, py_image_flood_fill); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_flood_fill_obj, 2, py_image_flood_fill); #endif // IMLIB_ENABLE_FLOOD_FILL @@ -1638,7 +1638,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_flood_fill_obj, 2, py_image_flood_fil // ISP Methods ////////////// -STATIC mp_obj_t py_awb(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_awb(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_max }; static const mp_arg_t allowed_args[] = { { MP_QSTR_max, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, @@ -1660,9 +1660,9 @@ STATIC mp_obj_t py_awb(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) imlib_awb(image, r_out, g_out, b_out); return pos_args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_awb_obj, 1, py_awb); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_awb_obj, 1, py_awb); -STATIC mp_obj_t py_ccm(mp_obj_t img_obj, mp_obj_t ccm_obj) { +static mp_obj_t py_ccm(mp_obj_t img_obj, mp_obj_t ccm_obj) { image_t *image = py_helper_arg_to_image(img_obj, ARG_IMAGE_MUTABLE); float ccm[12] = {}; @@ -1711,9 +1711,9 @@ STATIC mp_obj_t py_ccm(mp_obj_t img_obj, mp_obj_t ccm_obj) { imlib_ccm(image, ccm, offset); return img_obj; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(py_ccm_obj, py_ccm); +static MP_DEFINE_CONST_FUN_OBJ_2(py_ccm_obj, py_ccm); -STATIC mp_obj_t py_image_gamma(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_image_gamma(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_gamma, ARG_contrast, ARG_brightness }; static const mp_arg_t allowed_args[] = { { MP_QSTR_gamma, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_rom_obj = MP_ROM_NONE } }, @@ -1735,7 +1735,7 @@ STATIC mp_obj_t py_image_gamma(uint n_args, const mp_obj_t *pos_args, mp_map_t * fb_alloc_free_till_mark(); return pos_args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_gamma_obj, 1, py_image_gamma); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_gamma_obj, 1, py_image_gamma); #endif // IMLIB_ENABLE_ISP_OPS @@ -1744,7 +1744,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_gamma_obj, 1, py_image_gamma); // Binary Methods ///////////////// -STATIC mp_obj_t py_image_binary(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_image_binary(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_thresholds, ARG_invert, ARG_zero, ARG_mask, ARG_to_bitmap, ARG_copy }; static const mp_arg_t allowed_args[] = { { MP_QSTR_thresholds, MP_ARG_OBJ | MP_ARG_REQUIRED, }, @@ -1809,15 +1809,15 @@ STATIC mp_obj_t py_image_binary(uint n_args, const mp_obj_t *pos_args, mp_map_t return py_image_from_struct(&out); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_binary_obj, 1, py_image_binary); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_binary_obj, 1, py_image_binary); -STATIC mp_obj_t py_image_invert(mp_obj_t img_obj) { +static mp_obj_t py_image_invert(mp_obj_t img_obj) { imlib_invert(py_helper_arg_to_image(img_obj, ARG_IMAGE_MUTABLE)); return img_obj; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_invert_obj, py_image_invert); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_invert_obj, py_image_invert); -STATIC mp_obj_t py_image_b_and(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_b_and(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); image_t *arg_msk = @@ -1839,9 +1839,9 @@ STATIC mp_obj_t py_image_b_and(uint n_args, const mp_obj_t *args, mp_map_t *kw_a return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_and_obj, 2, py_image_b_and); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_and_obj, 2, py_image_b_and); -STATIC mp_obj_t py_image_b_nand(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_b_nand(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); image_t *arg_msk = @@ -1863,9 +1863,9 @@ STATIC mp_obj_t py_image_b_nand(uint n_args, const mp_obj_t *args, mp_map_t *kw_ return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_nand_obj, 2, py_image_b_nand); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_nand_obj, 2, py_image_b_nand); -STATIC mp_obj_t py_image_b_or(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_b_or(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); image_t *arg_msk = @@ -1887,9 +1887,9 @@ STATIC mp_obj_t py_image_b_or(uint n_args, const mp_obj_t *args, mp_map_t *kw_ar return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_or_obj, 2, py_image_b_or); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_or_obj, 2, py_image_b_or); -STATIC mp_obj_t py_image_b_nor(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_b_nor(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); image_t *arg_msk = @@ -1911,9 +1911,9 @@ STATIC mp_obj_t py_image_b_nor(uint n_args, const mp_obj_t *args, mp_map_t *kw_a return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_nor_obj, 2, py_image_b_nor); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_nor_obj, 2, py_image_b_nor); -STATIC mp_obj_t py_image_b_xor(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_b_xor(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); image_t *arg_msk = @@ -1935,9 +1935,9 @@ STATIC mp_obj_t py_image_b_xor(uint n_args, const mp_obj_t *args, mp_map_t *kw_a return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_xor_obj, 2, py_image_b_xor); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_xor_obj, 2, py_image_b_xor); -STATIC mp_obj_t py_image_b_xnor(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_b_xnor(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); image_t *arg_msk = @@ -1959,7 +1959,7 @@ STATIC mp_obj_t py_image_b_xnor(uint n_args, const mp_obj_t *args, mp_map_t *kw_ return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_xnor_obj, 2, py_image_b_xnor); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_b_xnor_obj, 2, py_image_b_xnor); static mp_obj_t py_image_binary_morph_op(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args, binary_morph_op_t op) { @@ -1986,25 +1986,25 @@ static mp_obj_t py_image_binary_morph_op(uint n_args, const mp_obj_t *pos_args, return pos_args[0]; } -STATIC mp_obj_t py_image_erode(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_image_erode(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { return py_image_binary_morph_op(n_args, pos_args, kw_args, imlib_erode); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_erode_obj, 2, py_image_erode); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_erode_obj, 2, py_image_erode); -STATIC mp_obj_t py_image_dilate(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_image_dilate(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { return py_image_binary_morph_op(n_args, pos_args, kw_args, imlib_dilate); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_dilate_obj, 2, py_image_dilate); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_dilate_obj, 2, py_image_dilate); -STATIC mp_obj_t py_image_open(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_image_open(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { return py_image_binary_morph_op(n_args, pos_args, kw_args, imlib_open); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_open_obj, 2, py_image_open); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_open_obj, 2, py_image_open); -STATIC mp_obj_t py_image_close(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_image_close(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { return py_image_binary_morph_op(n_args, pos_args, kw_args, imlib_close); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_close_obj, 2, py_image_close); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_close_obj, 2, py_image_close); #endif // IMLIB_ENABLE_BINARY_OPS #ifdef IMLIB_ENABLE_MATH_OPS @@ -2012,7 +2012,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_close_obj, 2, py_image_close); // Math Methods /////////////// -STATIC mp_obj_t py_image_replace(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_replace(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); bool arg_hmirror = @@ -2057,9 +2057,9 @@ STATIC mp_obj_t py_image_replace(uint n_args, const mp_obj_t *args, mp_map_t *kw py_helper_update_framebuffer(arg_img); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_replace_obj, 1, py_image_replace); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_replace_obj, 1, py_image_replace); -STATIC mp_obj_t py_image_add(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_add(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); image_t *arg_msk = @@ -2081,9 +2081,9 @@ STATIC mp_obj_t py_image_add(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_add_obj, 2, py_image_add); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_add_obj, 2, py_image_add); -STATIC mp_obj_t py_image_sub(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_sub(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); bool arg_reverse = @@ -2107,9 +2107,9 @@ STATIC mp_obj_t py_image_sub(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_sub_obj, 2, py_image_sub); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_sub_obj, 2, py_image_sub); -STATIC mp_obj_t py_image_min(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_min(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); image_t *arg_msk = @@ -2131,9 +2131,9 @@ STATIC mp_obj_t py_image_min(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_min_obj, 2, py_image_min); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_min_obj, 2, py_image_min); -STATIC mp_obj_t py_image_max(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_max(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); image_t *arg_msk = @@ -2155,9 +2155,9 @@ STATIC mp_obj_t py_image_max(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_max_obj, 2, py_image_max); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_max_obj, 2, py_image_max); -STATIC mp_obj_t py_image_difference(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_difference(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); image_t *arg_msk = @@ -2179,9 +2179,9 @@ STATIC mp_obj_t py_image_difference(uint n_args, const mp_obj_t *args, mp_map_t return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_difference_obj, 2, py_image_difference); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_difference_obj, 2, py_image_difference); -STATIC mp_obj_t py_image_blend(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_blend(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); float arg_alpha = @@ -2206,19 +2206,19 @@ STATIC mp_obj_t py_image_blend(uint n_args, const mp_obj_t *args, mp_map_t *kw_a return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_blend_obj, 2, py_image_blend); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_blend_obj, 2, py_image_blend); #endif//IMLIB_ENABLE_MATH_OPS #if defined(IMLIB_ENABLE_MATH_OPS) && defined(IMLIB_ENABLE_BINARY_OPS) -STATIC mp_obj_t py_image_top_hat(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_image_top_hat(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { return py_image_binary_morph_op(n_args, pos_args, kw_args, imlib_top_hat); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_top_hat_obj, 2, py_image_top_hat); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_top_hat_obj, 2, py_image_top_hat); -STATIC mp_obj_t py_image_black_hat(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_image_black_hat(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { return py_image_binary_morph_op(n_args, pos_args, kw_args, imlib_black_hat); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_black_hat_obj, 2, py_image_black_hat); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_black_hat_obj, 2, py_image_black_hat); #endif // defined(IMLIB_ENABLE_MATH_OPS) && defined(IMLIB_ENABLE_BINARY_OPS) //////////////////// @@ -2244,10 +2244,10 @@ static mp_obj_t py_image_histeq(uint n_args, const mp_obj_t *args, mp_map_t *kw_ fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_histeq_obj, 1, py_image_histeq); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_histeq_obj, 1, py_image_histeq); #ifdef IMLIB_ENABLE_MEAN -STATIC mp_obj_t py_image_mean(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_mean(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); int arg_ksize = @@ -2266,11 +2266,11 @@ STATIC mp_obj_t py_image_mean(uint n_args, const mp_obj_t *args, mp_map_t *kw_ar fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mean_obj, 2, py_image_mean); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mean_obj, 2, py_image_mean); #endif // IMLIB_ENABLE_MEAN #ifdef IMLIB_ENABLE_MEDIAN -STATIC mp_obj_t py_image_median(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_median(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); int arg_ksize = @@ -2292,11 +2292,11 @@ STATIC mp_obj_t py_image_median(uint n_args, const mp_obj_t *args, mp_map_t *kw_ fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_median_obj, 2, py_image_median); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_median_obj, 2, py_image_median); #endif // IMLIB_ENABLE_MEDIAN #ifdef IMLIB_ENABLE_MODE -STATIC mp_obj_t py_image_mode(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_mode(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); int arg_ksize = @@ -2315,11 +2315,11 @@ STATIC mp_obj_t py_image_mode(uint n_args, const mp_obj_t *args, mp_map_t *kw_ar fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mode_obj, 2, py_image_mode); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_mode_obj, 2, py_image_mode); #endif // IMLIB_ENABLE_MODE #ifdef IMLIB_ENABLE_MIDPOINT -STATIC mp_obj_t py_image_midpoint(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_midpoint(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); int arg_ksize = @@ -2341,11 +2341,11 @@ STATIC mp_obj_t py_image_midpoint(uint n_args, const mp_obj_t *args, mp_map_t *k fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_midpoint_obj, 2, py_image_midpoint); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_midpoint_obj, 2, py_image_midpoint); #endif // IMLIB_ENABLE_MIDPOINT #ifdef IMLIB_ENABLE_MORPH -STATIC mp_obj_t py_image_morph(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_morph(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); int arg_ksize = @@ -2387,11 +2387,11 @@ STATIC mp_obj_t py_image_morph(uint n_args, const mp_obj_t *args, mp_map_t *kw_a fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_morph_obj, 3, py_image_morph); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_morph_obj, 3, py_image_morph); #endif //IMLIB_ENABLE_MORPH #ifdef IMLIB_ENABLE_GAUSSIAN -STATIC mp_obj_t py_image_gaussian(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_gaussian(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); int arg_ksize = @@ -2443,11 +2443,11 @@ STATIC mp_obj_t py_image_gaussian(uint n_args, const mp_obj_t *args, mp_map_t *k fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_gaussian_obj, 2, py_image_gaussian); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_gaussian_obj, 2, py_image_gaussian); #endif // IMLIB_ENABLE_GAUSSIAN #ifdef IMLIB_ENABLE_LAPLACIAN -STATIC mp_obj_t py_image_laplacian(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_laplacian(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); int arg_ksize = @@ -2501,11 +2501,11 @@ STATIC mp_obj_t py_image_laplacian(uint n_args, const mp_obj_t *args, mp_map_t * fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_laplacian_obj, 2, py_image_laplacian); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_laplacian_obj, 2, py_image_laplacian); #endif // IMLIB_ENABLE_LAPLACIAN #ifdef IMLIB_ENABLE_BILATERAL -STATIC mp_obj_t py_image_bilateral(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_bilateral(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); int arg_ksize = @@ -2529,7 +2529,7 @@ STATIC mp_obj_t py_image_bilateral(uint n_args, const mp_obj_t *args, mp_map_t * fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_bilateral_obj, 2, py_image_bilateral); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_bilateral_obj, 2, py_image_bilateral); #endif // IMLIB_ENABLE_BILATERAL //////////////////// @@ -2550,7 +2550,7 @@ static mp_obj_t py_image_linpolar(uint n_args, const mp_obj_t *args, mp_map_t *k fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_linpolar_obj, 1, py_image_linpolar); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_linpolar_obj, 1, py_image_linpolar); #endif // IMLIB_ENABLE_LINPOLAR #ifdef IMLIB_ENABLE_LOGPOLAR @@ -2567,11 +2567,11 @@ static mp_obj_t py_image_logpolar(uint n_args, const mp_obj_t *args, mp_map_t *k fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_logpolar_obj, 1, py_image_logpolar); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_logpolar_obj, 1, py_image_logpolar); #endif // IMLIB_ENABLE_LOGPOLAR #ifdef IMLIB_ENABLE_LENS_CORR -STATIC mp_obj_t py_image_lens_corr(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_lens_corr(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); PY_ASSERT_FALSE_MSG(arg_img->w % 2, "Width must be even!"); @@ -2593,11 +2593,11 @@ STATIC mp_obj_t py_image_lens_corr(uint n_args, const mp_obj_t *args, mp_map_t * fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lens_corr_obj, 1, py_image_lens_corr); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lens_corr_obj, 1, py_image_lens_corr); #endif // IMLIB_ENABLE_LENS_CORR #ifdef IMLIB_ENABLE_ROTATION_CORR -STATIC mp_obj_t py_image_rotation_corr(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t py_image_rotation_corr(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); float arg_x_rotation = @@ -2626,7 +2626,7 @@ STATIC mp_obj_t py_image_rotation_corr(uint n_args, const mp_obj_t *args, mp_map fb_alloc_free_till_mark(); return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rotation_corr_obj, 1, py_image_rotation_corr); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rotation_corr_obj, 1, py_image_rotation_corr); #endif // IMLIB_ENABLE_ROTATION_CORR ////////////// @@ -2677,33 +2677,33 @@ static mp_obj_t py_similarity_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t mp_obj_t py_similarity_mean(mp_obj_t self_in) { return ((py_similarity_obj_t *) self_in)->avg; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_similarity_mean_obj, py_similarity_mean); +static MP_DEFINE_CONST_FUN_OBJ_1(py_similarity_mean_obj, py_similarity_mean); mp_obj_t py_similarity_stdev(mp_obj_t self_in) { return ((py_similarity_obj_t *) self_in)->std; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_similarity_stdev_obj, py_similarity_stdev); +static MP_DEFINE_CONST_FUN_OBJ_1(py_similarity_stdev_obj, py_similarity_stdev); mp_obj_t py_similarity_min(mp_obj_t self_in) { return ((py_similarity_obj_t *) self_in)->min; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_similarity_min_obj, py_similarity_min); +static MP_DEFINE_CONST_FUN_OBJ_1(py_similarity_min_obj, py_similarity_min); mp_obj_t py_similarity_max(mp_obj_t self_in) { return ((py_similarity_obj_t *) self_in)->max; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_similarity_max_obj, py_similarity_max); +static MP_DEFINE_CONST_FUN_OBJ_1(py_similarity_max_obj, py_similarity_max); -STATIC const mp_rom_map_elem_t py_similarity_locals_dict_table[] = { +static const mp_rom_map_elem_t py_similarity_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_mean), MP_ROM_PTR(&py_similarity_mean_obj) }, { MP_ROM_QSTR(MP_QSTR_stdev), MP_ROM_PTR(&py_similarity_stdev_obj) }, { MP_ROM_QSTR(MP_QSTR_min), MP_ROM_PTR(&py_similarity_min_obj) }, { MP_ROM_QSTR(MP_QSTR_max), MP_ROM_PTR(&py_similarity_max_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_similarity_locals_dict, py_similarity_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_similarity_locals_dict, py_similarity_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_similarity_type, MP_QSTR_similarity, MP_TYPE_FLAG_NONE, @@ -2771,7 +2771,7 @@ static mp_obj_t py_image_get_similarity(uint n_args, const mp_obj_t *pos_args, m o->max = mp_obj_new_float(max); return o; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_get_similarity_obj, 1, py_image_get_similarity); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_get_similarity_obj, 1, py_image_get_similarity); #endif // IMLIB_ENABLE_GET_SIMILARITY // Statistics Object // @@ -2897,164 +2897,164 @@ static mp_obj_t py_statistics_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t mp_obj_t py_statistics_mean(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LMean; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_mean_obj, py_statistics_mean); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_mean_obj, py_statistics_mean); mp_obj_t py_statistics_median(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LMedian; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_median_obj, py_statistics_median); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_median_obj, py_statistics_median); mp_obj_t py_statistics_mode(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LMode; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_mode_obj, py_statistics_mode); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_mode_obj, py_statistics_mode); mp_obj_t py_statistics_stdev(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LSTDev; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_stdev_obj, py_statistics_stdev); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_stdev_obj, py_statistics_stdev); mp_obj_t py_statistics_min(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LMin; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_min_obj, py_statistics_min); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_min_obj, py_statistics_min); mp_obj_t py_statistics_max(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LMax; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_max_obj, py_statistics_max); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_max_obj, py_statistics_max); mp_obj_t py_statistics_lq(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LLQ; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_lq_obj, py_statistics_lq); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_lq_obj, py_statistics_lq); mp_obj_t py_statistics_uq(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LUQ; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_uq_obj, py_statistics_uq); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_uq_obj, py_statistics_uq); mp_obj_t py_statistics_l_mean(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LMean; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_mean_obj, py_statistics_l_mean); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_mean_obj, py_statistics_l_mean); mp_obj_t py_statistics_l_median(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LMedian; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_median_obj, py_statistics_l_median); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_median_obj, py_statistics_l_median); mp_obj_t py_statistics_l_mode(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LMode; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_mode_obj, py_statistics_l_mode); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_mode_obj, py_statistics_l_mode); mp_obj_t py_statistics_l_stdev(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LSTDev; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_stdev_obj, py_statistics_l_stdev); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_stdev_obj, py_statistics_l_stdev); mp_obj_t py_statistics_l_min(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LMin; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_min_obj, py_statistics_l_min); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_min_obj, py_statistics_l_min); mp_obj_t py_statistics_l_max(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LMax; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_max_obj, py_statistics_l_max); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_max_obj, py_statistics_l_max); mp_obj_t py_statistics_l_lq(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LLQ; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_lq_obj, py_statistics_l_lq); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_lq_obj, py_statistics_l_lq); mp_obj_t py_statistics_l_uq(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->LUQ; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_uq_obj, py_statistics_l_uq); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_l_uq_obj, py_statistics_l_uq); mp_obj_t py_statistics_a_mean(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->AMean; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_mean_obj, py_statistics_a_mean); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_mean_obj, py_statistics_a_mean); mp_obj_t py_statistics_a_median(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->AMedian; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_median_obj, py_statistics_a_median); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_median_obj, py_statistics_a_median); mp_obj_t py_statistics_a_mode(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->AMode; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_mode_obj, py_statistics_a_mode); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_mode_obj, py_statistics_a_mode); mp_obj_t py_statistics_a_stdev(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->ASTDev; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_stdev_obj, py_statistics_a_stdev); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_stdev_obj, py_statistics_a_stdev); mp_obj_t py_statistics_a_min(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->AMin; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_min_obj, py_statistics_a_min); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_min_obj, py_statistics_a_min); mp_obj_t py_statistics_a_max(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->AMax; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_max_obj, py_statistics_a_max); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_max_obj, py_statistics_a_max); mp_obj_t py_statistics_a_lq(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->ALQ; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_lq_obj, py_statistics_a_lq); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_lq_obj, py_statistics_a_lq); mp_obj_t py_statistics_a_uq(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->AUQ; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_uq_obj, py_statistics_a_uq); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_a_uq_obj, py_statistics_a_uq); mp_obj_t py_statistics_b_mean(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->BMean; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_mean_obj, py_statistics_b_mean); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_mean_obj, py_statistics_b_mean); mp_obj_t py_statistics_b_median(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->BMedian; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_median_obj, py_statistics_b_median); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_median_obj, py_statistics_b_median); mp_obj_t py_statistics_b_mode(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->BMode; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_mode_obj, py_statistics_b_mode); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_mode_obj, py_statistics_b_mode); mp_obj_t py_statistics_b_stdev(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->BSTDev; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_stdev_obj, py_statistics_b_stdev); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_stdev_obj, py_statistics_b_stdev); mp_obj_t py_statistics_b_min(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->BMin; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_min_obj, py_statistics_b_min); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_min_obj, py_statistics_b_min); mp_obj_t py_statistics_b_max(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->BMax; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_max_obj, py_statistics_b_max); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_max_obj, py_statistics_b_max); mp_obj_t py_statistics_b_lq(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->BLQ; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_lq_obj, py_statistics_b_lq); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_lq_obj, py_statistics_b_lq); mp_obj_t py_statistics_b_uq(mp_obj_t self_in) { return ((py_statistics_obj_t *) self_in)->BUQ; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_uq_obj, py_statistics_b_uq); +static MP_DEFINE_CONST_FUN_OBJ_1(py_statistics_b_uq_obj, py_statistics_b_uq); -STATIC const mp_rom_map_elem_t py_statistics_locals_dict_table[] = { +static const mp_rom_map_elem_t py_statistics_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_mean), MP_ROM_PTR(&py_statistics_mean_obj) }, { MP_ROM_QSTR(MP_QSTR_median), MP_ROM_PTR(&py_statistics_median_obj) }, { MP_ROM_QSTR(MP_QSTR_mode), MP_ROM_PTR(&py_statistics_mode_obj) }, @@ -3089,9 +3089,9 @@ STATIC const mp_rom_map_elem_t py_statistics_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_b_uq), MP_ROM_PTR(&py_statistics_b_uq_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_statistics_locals_dict, py_statistics_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_statistics_locals_dict, py_statistics_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_statistics_type, MP_QSTR_statistics, MP_TYPE_FLAG_NONE, @@ -3160,33 +3160,33 @@ static mp_obj_t py_percentile_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t mp_obj_t py_percentile_value(mp_obj_t self_in) { return ((py_percentile_obj_t *) self_in)->LValue; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_percentile_value_obj, py_percentile_value); +static MP_DEFINE_CONST_FUN_OBJ_1(py_percentile_value_obj, py_percentile_value); mp_obj_t py_percentile_l_value(mp_obj_t self_in) { return ((py_percentile_obj_t *) self_in)->LValue; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_percentile_l_value_obj, py_percentile_l_value); +static MP_DEFINE_CONST_FUN_OBJ_1(py_percentile_l_value_obj, py_percentile_l_value); mp_obj_t py_percentile_a_value(mp_obj_t self_in) { return ((py_percentile_obj_t *) self_in)->AValue; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_percentile_a_value_obj, py_percentile_a_value); +static MP_DEFINE_CONST_FUN_OBJ_1(py_percentile_a_value_obj, py_percentile_a_value); mp_obj_t py_percentile_b_value(mp_obj_t self_in) { return ((py_percentile_obj_t *) self_in)->BValue; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_percentile_b_value_obj, py_percentile_b_value); +static MP_DEFINE_CONST_FUN_OBJ_1(py_percentile_b_value_obj, py_percentile_b_value); -STATIC const mp_rom_map_elem_t py_percentile_locals_dict_table[] = { +static const mp_rom_map_elem_t py_percentile_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&py_percentile_value_obj) }, { MP_ROM_QSTR(MP_QSTR_l_value), MP_ROM_PTR(&py_percentile_l_value_obj) }, { MP_ROM_QSTR(MP_QSTR_a_value), MP_ROM_PTR(&py_percentile_a_value_obj) }, { MP_ROM_QSTR(MP_QSTR_b_value), MP_ROM_PTR(&py_percentile_b_value_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_percentile_locals_dict, py_percentile_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_percentile_locals_dict, py_percentile_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_percentile_type, MP_QSTR_percentile, MP_TYPE_FLAG_NONE, @@ -3255,33 +3255,33 @@ static mp_obj_t py_threshold_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t v mp_obj_t py_threshold_value(mp_obj_t self_in) { return ((py_threshold_obj_t *) self_in)->LValue; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_threshold_value_obj, py_threshold_value); +static MP_DEFINE_CONST_FUN_OBJ_1(py_threshold_value_obj, py_threshold_value); mp_obj_t py_threshold_l_value(mp_obj_t self_in) { return ((py_threshold_obj_t *) self_in)->LValue; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_threshold_l_value_obj, py_threshold_l_value); +static MP_DEFINE_CONST_FUN_OBJ_1(py_threshold_l_value_obj, py_threshold_l_value); mp_obj_t py_threshold_a_value(mp_obj_t self_in) { return ((py_threshold_obj_t *) self_in)->AValue; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_threshold_a_value_obj, py_threshold_a_value); +static MP_DEFINE_CONST_FUN_OBJ_1(py_threshold_a_value_obj, py_threshold_a_value); mp_obj_t py_threshold_b_value(mp_obj_t self_in) { return ((py_threshold_obj_t *) self_in)->BValue; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_threshold_b_value_obj, py_threshold_b_value); +static MP_DEFINE_CONST_FUN_OBJ_1(py_threshold_b_value_obj, py_threshold_b_value); -STATIC const mp_rom_map_elem_t py_threshold_locals_dict_table[] = { +static const mp_rom_map_elem_t py_threshold_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&py_threshold_value_obj) }, { MP_ROM_QSTR(MP_QSTR_l_value), MP_ROM_PTR(&py_threshold_l_value_obj) }, { MP_ROM_QSTR(MP_QSTR_a_value), MP_ROM_PTR(&py_threshold_a_value_obj) }, { MP_ROM_QSTR(MP_QSTR_b_value), MP_ROM_PTR(&py_threshold_b_value_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_threshold_locals_dict, py_threshold_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_threshold_locals_dict, py_threshold_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_threshold_type, MP_QSTR_threshold, MP_TYPE_FLAG_NONE, @@ -3355,22 +3355,22 @@ static mp_obj_t py_histogram_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t v mp_obj_t py_histogram_bins(mp_obj_t self_in) { return ((py_histogram_obj_t *) self_in)->LBins; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_histogram_bins_obj, py_histogram_bins); +static MP_DEFINE_CONST_FUN_OBJ_1(py_histogram_bins_obj, py_histogram_bins); mp_obj_t py_histogram_l_bins(mp_obj_t self_in) { return ((py_histogram_obj_t *) self_in)->LBins; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_histogram_l_bins_obj, py_histogram_l_bins); +static MP_DEFINE_CONST_FUN_OBJ_1(py_histogram_l_bins_obj, py_histogram_l_bins); mp_obj_t py_histogram_a_bins(mp_obj_t self_in) { return ((py_histogram_obj_t *) self_in)->ABins; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_histogram_a_bins_obj, py_histogram_a_bins); +static MP_DEFINE_CONST_FUN_OBJ_1(py_histogram_a_bins_obj, py_histogram_a_bins); mp_obj_t py_histogram_b_bins(mp_obj_t self_in) { return ((py_histogram_obj_t *) self_in)->BBins; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_histogram_b_bins_obj, py_histogram_b_bins); +static MP_DEFINE_CONST_FUN_OBJ_1(py_histogram_b_bins_obj, py_histogram_b_bins); mp_obj_t py_histogram_get_percentile(mp_obj_t self_in, mp_obj_t percentile) { histogram_t hist; @@ -3408,7 +3408,7 @@ mp_obj_t py_histogram_get_percentile(mp_obj_t self_in, mp_obj_t percentile) { return o; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(py_histogram_get_percentile_obj, py_histogram_get_percentile); +static MP_DEFINE_CONST_FUN_OBJ_2(py_histogram_get_percentile_obj, py_histogram_get_percentile); mp_obj_t py_histogram_get_threshold(mp_obj_t self_in) { histogram_t hist; @@ -3446,7 +3446,7 @@ mp_obj_t py_histogram_get_threshold(mp_obj_t self_in) { return o; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_histogram_get_threshold_obj, py_histogram_get_threshold); +static MP_DEFINE_CONST_FUN_OBJ_1(py_histogram_get_threshold_obj, py_histogram_get_threshold); mp_obj_t py_histogram_get_statistics(mp_obj_t self_in) { histogram_t hist; @@ -3505,9 +3505,9 @@ mp_obj_t py_histogram_get_statistics(mp_obj_t self_in) { return o; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_histogram_get_statistics_obj, py_histogram_get_statistics); +static MP_DEFINE_CONST_FUN_OBJ_1(py_histogram_get_statistics_obj, py_histogram_get_statistics); -STATIC const mp_rom_map_elem_t py_histogram_locals_dict_table[] = { +static const mp_rom_map_elem_t py_histogram_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_bins), MP_ROM_PTR(&py_histogram_bins_obj) }, { MP_ROM_QSTR(MP_QSTR_l_bins), MP_ROM_PTR(&py_histogram_l_bins_obj) }, { MP_ROM_QSTR(MP_QSTR_a_bins), MP_ROM_PTR(&py_histogram_a_bins_obj) }, @@ -3519,9 +3519,9 @@ STATIC const mp_rom_map_elem_t py_histogram_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_statistics), MP_ROM_PTR(&py_histogram_get_statistics_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_histogram_locals_dict, py_histogram_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_histogram_locals_dict, py_histogram_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_histogram_type, MP_QSTR_histogram, MP_TYPE_FLAG_NONE, @@ -3629,7 +3629,7 @@ static mp_obj_t py_image_get_histogram(uint n_args, const mp_obj_t *args, mp_map return o; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_get_histogram_obj, 1, py_image_get_histogram); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_get_histogram_obj, 1, py_image_get_histogram); static mp_obj_t py_image_get_statistics(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { image_t *arg_img = py_helper_arg_to_image(args[0], ARG_IMAGE_MUTABLE); @@ -3741,7 +3741,7 @@ static mp_obj_t py_image_get_statistics(uint n_args, const mp_obj_t *args, mp_ma return o; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_get_statistics_obj, 1, py_image_get_statistics); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_get_statistics_obj, 1, py_image_get_statistics); // Line Object // #define py_line_obj_size 8 @@ -3797,49 +3797,49 @@ mp_obj_t py_line_line(mp_obj_t self_in) { ((py_line_obj_t *) self_in)->x2, ((py_line_obj_t *) self_in)->y2}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_line_line_obj, py_line_line); +static MP_DEFINE_CONST_FUN_OBJ_1(py_line_line_obj, py_line_line); mp_obj_t py_line_x1(mp_obj_t self_in) { return ((py_line_obj_t *) self_in)->x1; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_line_x1_obj, py_line_x1); +static MP_DEFINE_CONST_FUN_OBJ_1(py_line_x1_obj, py_line_x1); mp_obj_t py_line_y1(mp_obj_t self_in) { return ((py_line_obj_t *) self_in)->y1; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_line_y1_obj, py_line_y1); +static MP_DEFINE_CONST_FUN_OBJ_1(py_line_y1_obj, py_line_y1); mp_obj_t py_line_x2(mp_obj_t self_in) { return ((py_line_obj_t *) self_in)->x2; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_line_x2_obj, py_line_x2); +static MP_DEFINE_CONST_FUN_OBJ_1(py_line_x2_obj, py_line_x2); mp_obj_t py_line_y2(mp_obj_t self_in) { return ((py_line_obj_t *) self_in)->y2; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_line_y2_obj, py_line_y2); +static MP_DEFINE_CONST_FUN_OBJ_1(py_line_y2_obj, py_line_y2); mp_obj_t py_line_length(mp_obj_t self_in) { return ((py_line_obj_t *) self_in)->length; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_line_length_obj, py_line_length); +static MP_DEFINE_CONST_FUN_OBJ_1(py_line_length_obj, py_line_length); mp_obj_t py_line_magnitude(mp_obj_t self_in) { return ((py_line_obj_t *) self_in)->magnitude; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_line_magnitude_obj, py_line_magnitude); +static MP_DEFINE_CONST_FUN_OBJ_1(py_line_magnitude_obj, py_line_magnitude); mp_obj_t py_line_theta(mp_obj_t self_in) { return ((py_line_obj_t *) self_in)->theta; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_line_theta_obj, py_line_theta); +static MP_DEFINE_CONST_FUN_OBJ_1(py_line_theta_obj, py_line_theta); mp_obj_t py_line_rho(mp_obj_t self_in) { return ((py_line_obj_t *) self_in)->rho; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_line_rho_obj, py_line_rho); +static MP_DEFINE_CONST_FUN_OBJ_1(py_line_rho_obj, py_line_rho); -STATIC const mp_rom_map_elem_t py_line_locals_dict_table[] = { +static const mp_rom_map_elem_t py_line_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_line), MP_ROM_PTR(&py_line_line_obj) }, { MP_ROM_QSTR(MP_QSTR_x1), MP_ROM_PTR(&py_line_x1_obj) }, { MP_ROM_QSTR(MP_QSTR_y1), MP_ROM_PTR(&py_line_y1_obj) }, @@ -3851,9 +3851,9 @@ STATIC const mp_rom_map_elem_t py_line_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_rho), MP_ROM_PTR(&py_line_rho_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_line_locals_dict, py_line_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_line_locals_dict, py_line_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_line_type, MP_QSTR_line, MP_TYPE_FLAG_NONE, @@ -3914,7 +3914,7 @@ static mp_obj_t py_image_get_regression(uint n_args, const mp_obj_t *args, mp_ma return o; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_get_regression_obj, 2, py_image_get_regression); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_get_regression_obj, 2, py_image_get_regression); /////////////// // Find Methods @@ -3985,12 +3985,12 @@ static mp_obj_t py_blob_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) mp_obj_t py_blob_corners(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->corners; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_corners_obj, py_blob_corners); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_corners_obj, py_blob_corners); mp_obj_t py_blob_min_corners(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->min_corners; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_min_corners_obj, py_blob_min_corners); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_min_corners_obj, py_blob_min_corners); mp_obj_t py_blob_rect(mp_obj_t self_in) { return mp_obj_new_tuple(4, (mp_obj_t []) {((py_blob_obj_t *) self_in)->x, @@ -3998,104 +3998,104 @@ mp_obj_t py_blob_rect(mp_obj_t self_in) { ((py_blob_obj_t *) self_in)->w, ((py_blob_obj_t *) self_in)->h}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_rect_obj, py_blob_rect); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_rect_obj, py_blob_rect); mp_obj_t py_blob_x(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->x; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_x_obj, py_blob_x); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_x_obj, py_blob_x); mp_obj_t py_blob_y(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->y; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_y_obj, py_blob_y); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_y_obj, py_blob_y); mp_obj_t py_blob_w(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->w; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_w_obj, py_blob_w); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_w_obj, py_blob_w); mp_obj_t py_blob_h(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->h; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_h_obj, py_blob_h); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_h_obj, py_blob_h); mp_obj_t py_blob_pixels(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->pixels; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_pixels_obj, py_blob_pixels); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_pixels_obj, py_blob_pixels); mp_obj_t py_blob_cx(mp_obj_t self_in) { return mp_obj_new_int(fast_roundf(mp_obj_get_float(((py_blob_obj_t *) self_in)->cx))); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_cx_obj, py_blob_cx); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_cx_obj, py_blob_cx); mp_obj_t py_blob_cxf(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->cx; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_cxf_obj, py_blob_cxf); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_cxf_obj, py_blob_cxf); mp_obj_t py_blob_cy(mp_obj_t self_in) { return mp_obj_new_int(fast_roundf(mp_obj_get_float(((py_blob_obj_t *) self_in)->cy))); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_cy_obj, py_blob_cy); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_cy_obj, py_blob_cy); mp_obj_t py_blob_cyf(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->cy; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_cyf_obj, py_blob_cyf); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_cyf_obj, py_blob_cyf); mp_obj_t py_blob_rotation(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->rotation; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_rotation_obj, py_blob_rotation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_rotation_obj, py_blob_rotation); mp_obj_t py_blob_rotation_deg(mp_obj_t self_in) { return mp_obj_new_int(IM_RAD2DEG(mp_obj_get_float(((py_blob_obj_t *) self_in)->rotation))); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_rotation_deg_obj, py_blob_rotation_deg); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_rotation_deg_obj, py_blob_rotation_deg); mp_obj_t py_blob_rotation_rad(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->rotation; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_rotation_rad_obj, py_blob_rotation_rad); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_rotation_rad_obj, py_blob_rotation_rad); mp_obj_t py_blob_code(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->code; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_code_obj, py_blob_code); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_code_obj, py_blob_code); mp_obj_t py_blob_count(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->count; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_count_obj, py_blob_count); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_count_obj, py_blob_count); mp_obj_t py_blob_perimeter(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->perimeter; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_perimeter_obj, py_blob_perimeter); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_perimeter_obj, py_blob_perimeter); mp_obj_t py_blob_roundness(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->roundness; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_roundness_obj, py_blob_roundness); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_roundness_obj, py_blob_roundness); mp_obj_t py_blob_elongation(mp_obj_t self_in) { return mp_obj_new_float(1 - mp_obj_get_float(((py_blob_obj_t *) self_in)->roundness)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_elongation_obj, py_blob_elongation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_elongation_obj, py_blob_elongation); mp_obj_t py_blob_area(mp_obj_t self_in) { return mp_obj_new_int(mp_obj_get_int(((py_blob_obj_t *) self_in)->w) * mp_obj_get_int(((py_blob_obj_t *) self_in)->h)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_area_obj, py_blob_area); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_area_obj, py_blob_area); mp_obj_t py_blob_density(mp_obj_t self_in) { int area = mp_obj_get_int(((py_blob_obj_t *) self_in)->w) * mp_obj_get_int(((py_blob_obj_t *) self_in)->h); int pixels = mp_obj_get_int(((py_blob_obj_t *) self_in)->pixels); return mp_obj_new_float(IM_DIV(pixels, ((float) area))); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_density_obj, py_blob_density); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_density_obj, py_blob_density); // Rect-area versus pixels (e.g. blob area) -> Above. // Rect-area versus perimeter -> Basically the same as the above with a different scale factor. @@ -4106,7 +4106,7 @@ mp_obj_t py_blob_compactness(mp_obj_t self_in) { float perimeter = mp_obj_get_int(((py_blob_obj_t *) self_in)->perimeter); return mp_obj_new_float(IM_DIV((pixels * 4 * M_PI), (perimeter * perimeter))); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_compactness_obj, py_blob_compactness); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_compactness_obj, py_blob_compactness); mp_obj_t py_blob_solidity(mp_obj_t self_in) { mp_obj_t *corners, *p0, *p1, *p2, *p3; @@ -4131,7 +4131,7 @@ mp_obj_t py_blob_solidity(mp_obj_t self_in) { int pixels = mp_obj_get_int(((py_blob_obj_t *) self_in)->pixels); return mp_obj_new_float(IM_MIN(IM_DIV(pixels, min_area), 1)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_solidity_obj, py_blob_solidity); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_solidity_obj, py_blob_solidity); mp_obj_t py_blob_convexity(mp_obj_t self_in) { mp_obj_t *corners, *p0, *p1, *p2, *p3; @@ -4158,7 +4158,7 @@ mp_obj_t py_blob_convexity(mp_obj_t self_in) { int perimeter = mp_obj_get_int(((py_blob_obj_t *) self_in)->perimeter); return mp_obj_new_float(IM_MIN(IM_DIV(d0 + d1 + d2 + d3, perimeter), 1)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_convexity_obj, py_blob_convexity); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_convexity_obj, py_blob_convexity); // Min rect-area versus pixels (e.g. blob area) -> Above. // Min rect-area versus perimeter -> Basically the same as the above with a different scale factor. // Min rect-perimeter versus pixels (e.g. blob area) -> Basically the same as the above with a different scale factor. @@ -4167,12 +4167,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_convexity_obj, py_blob_convexity); mp_obj_t py_blob_x_hist_bins(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->x_hist_bins; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_x_hist_bins_obj, py_blob_x_hist_bins); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_x_hist_bins_obj, py_blob_x_hist_bins); mp_obj_t py_blob_y_hist_bins(mp_obj_t self_in) { return ((py_blob_obj_t *) self_in)->y_hist_bins; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_y_hist_bins_obj, py_blob_y_hist_bins); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_y_hist_bins_obj, py_blob_y_hist_bins); mp_obj_t py_blob_major_axis_line(mp_obj_t self_in) { mp_obj_t *corners, *p0, *p1, *p2, *p3; @@ -4216,7 +4216,7 @@ mp_obj_t py_blob_major_axis_line(mp_obj_t self_in) { mp_obj_new_int(m3y)}); } } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_major_axis_line_obj, py_blob_major_axis_line); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_major_axis_line_obj, py_blob_major_axis_line); mp_obj_t py_blob_minor_axis_line(mp_obj_t self_in) { mp_obj_t *corners, *p0, *p1, *p2, *p3; @@ -4260,7 +4260,7 @@ mp_obj_t py_blob_minor_axis_line(mp_obj_t self_in) { mp_obj_new_int(m3y)}); } } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_minor_axis_line_obj, py_blob_minor_axis_line); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_minor_axis_line_obj, py_blob_minor_axis_line); mp_obj_t py_blob_enclosing_circle(mp_obj_t self_in) { mp_obj_t *corners, *p0, *p1, *p2, *p3; @@ -4293,7 +4293,7 @@ mp_obj_t py_blob_enclosing_circle(mp_obj_t self_in) { mp_obj_new_int(cy), mp_obj_new_int(fast_roundf(d))}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_enclosing_circle_obj, py_blob_enclosing_circle); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_enclosing_circle_obj, py_blob_enclosing_circle); mp_obj_t py_blob_enclosed_ellipse(mp_obj_t self_in) { mp_obj_t *corners, *p0, *p1, *p2, *p3; @@ -4349,9 +4349,9 @@ mp_obj_t py_blob_enclosed_ellipse(mp_obj_t self_in) { mp_obj_new_int(b), mp_obj_new_int(r)}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_blob_enclosed_ellipse_obj, py_blob_enclosed_ellipse); +static MP_DEFINE_CONST_FUN_OBJ_1(py_blob_enclosed_ellipse_obj, py_blob_enclosed_ellipse); -STATIC const mp_rom_map_elem_t py_blob_locals_dict_table[] = { +static const mp_rom_map_elem_t py_blob_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_corners), MP_ROM_PTR(&py_blob_corners_obj) }, { MP_ROM_QSTR(MP_QSTR_min_corners), MP_ROM_PTR(&py_blob_min_corners_obj) }, { MP_ROM_QSTR(MP_QSTR_rect), MP_ROM_PTR(&py_blob_rect_obj) }, @@ -4386,9 +4386,9 @@ STATIC const mp_rom_map_elem_t py_blob_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_enclosed_ellipse), MP_ROM_PTR(&py_blob_enclosed_ellipse_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_blob_locals_dict, py_blob_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_blob_locals_dict, py_blob_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_blob_type, MP_QSTR_blob, MP_TYPE_FLAG_NONE, @@ -4534,7 +4534,7 @@ static mp_obj_t py_image_find_blobs(uint n_args, const mp_obj_t *args, mp_map_t return objects_list; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_blobs_obj, 2, py_image_find_blobs); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_blobs_obj, 2, py_image_find_blobs); #ifdef IMLIB_ENABLE_FIND_LINES static mp_obj_t py_image_find_lines(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { @@ -4579,7 +4579,7 @@ static mp_obj_t py_image_find_lines(uint n_args, const mp_obj_t *args, mp_map_t return objects_list; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_lines_obj, 1, py_image_find_lines); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_lines_obj, 1, py_image_find_lines); #endif // IMLIB_ENABLE_FIND_LINES #ifdef IMLIB_ENABLE_FIND_LINE_SEGMENTS @@ -4620,7 +4620,7 @@ static mp_obj_t py_image_find_line_segments(uint n_args, const mp_obj_t *args, m return objects_list; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_line_segments_obj, 1, py_image_find_line_segments); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_line_segments_obj, 1, py_image_find_line_segments); #endif // IMLIB_ENABLE_FIND_LINE_SEGMENTS #ifdef IMLIB_ENABLE_FIND_CIRCLES @@ -4669,29 +4669,29 @@ mp_obj_t py_circle_circle(mp_obj_t self_in) { ((py_circle_obj_t *) self_in)->y, ((py_circle_obj_t *) self_in)->r}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_circle_circle_obj, py_circle_circle); +static MP_DEFINE_CONST_FUN_OBJ_1(py_circle_circle_obj, py_circle_circle); mp_obj_t py_circle_x(mp_obj_t self_in) { return ((py_circle_obj_t *) self_in)->x; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_circle_x_obj, py_circle_x); +static MP_DEFINE_CONST_FUN_OBJ_1(py_circle_x_obj, py_circle_x); mp_obj_t py_circle_y(mp_obj_t self_in) { return ((py_circle_obj_t *) self_in)->y; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_circle_y_obj, py_circle_y); +static MP_DEFINE_CONST_FUN_OBJ_1(py_circle_y_obj, py_circle_y); mp_obj_t py_circle_r(mp_obj_t self_in) { return ((py_circle_obj_t *) self_in)->r; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_circle_r_obj, py_circle_r); +static MP_DEFINE_CONST_FUN_OBJ_1(py_circle_r_obj, py_circle_r); mp_obj_t py_circle_magnitude(mp_obj_t self_in) { return ((py_circle_obj_t *) self_in)->magnitude; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_circle_magnitude_obj, py_circle_magnitude); +static MP_DEFINE_CONST_FUN_OBJ_1(py_circle_magnitude_obj, py_circle_magnitude); -STATIC const mp_rom_map_elem_t py_circle_locals_dict_table[] = { +static const mp_rom_map_elem_t py_circle_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_circle), MP_ROM_PTR(&py_circle_circle_obj) }, { MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&py_circle_x_obj) }, { MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&py_circle_y_obj) }, @@ -4699,9 +4699,9 @@ STATIC const mp_rom_map_elem_t py_circle_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_magnitude), MP_ROM_PTR(&py_circle_magnitude_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_circle_locals_dict, py_circle_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_circle_locals_dict, py_circle_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_circle_type, MP_QSTR_circle, MP_TYPE_FLAG_NONE, @@ -4753,7 +4753,7 @@ static mp_obj_t py_image_find_circles(uint n_args, const mp_obj_t *args, mp_map_ return objects_list; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_circles_obj, 1, py_image_find_circles); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_circles_obj, 1, py_image_find_circles); #endif // IMLIB_ENABLE_FIND_CIRCLES #ifdef IMLIB_ENABLE_FIND_RECTS @@ -4803,7 +4803,7 @@ static mp_obj_t py_rect_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) mp_obj_t py_rect_corners(mp_obj_t self_in) { return ((py_rect_obj_t *) self_in)->corners; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_rect_corners_obj, py_rect_corners); +static MP_DEFINE_CONST_FUN_OBJ_1(py_rect_corners_obj, py_rect_corners); mp_obj_t py_rect_rect(mp_obj_t self_in) { return mp_obj_new_tuple(4, (mp_obj_t []) {((py_rect_obj_t *) self_in)->x, @@ -4811,34 +4811,34 @@ mp_obj_t py_rect_rect(mp_obj_t self_in) { ((py_rect_obj_t *) self_in)->w, ((py_rect_obj_t *) self_in)->h}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_rect_rect_obj, py_rect_rect); +static MP_DEFINE_CONST_FUN_OBJ_1(py_rect_rect_obj, py_rect_rect); mp_obj_t py_rect_x(mp_obj_t self_in) { return ((py_rect_obj_t *) self_in)->x; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_rect_x_obj, py_rect_x); +static MP_DEFINE_CONST_FUN_OBJ_1(py_rect_x_obj, py_rect_x); mp_obj_t py_rect_y(mp_obj_t self_in) { return ((py_rect_obj_t *) self_in)->y; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_rect_y_obj, py_rect_y); +static MP_DEFINE_CONST_FUN_OBJ_1(py_rect_y_obj, py_rect_y); mp_obj_t py_rect_w(mp_obj_t self_in) { return ((py_rect_obj_t *) self_in)->w; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_rect_w_obj, py_rect_w); +static MP_DEFINE_CONST_FUN_OBJ_1(py_rect_w_obj, py_rect_w); mp_obj_t py_rect_h(mp_obj_t self_in) { return ((py_rect_obj_t *) self_in)->h; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_rect_h_obj, py_rect_h); +static MP_DEFINE_CONST_FUN_OBJ_1(py_rect_h_obj, py_rect_h); mp_obj_t py_rect_magnitude(mp_obj_t self_in) { return ((py_rect_obj_t *) self_in)->magnitude; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_rect_magnitude_obj, py_rect_magnitude); +static MP_DEFINE_CONST_FUN_OBJ_1(py_rect_magnitude_obj, py_rect_magnitude); -STATIC const mp_rom_map_elem_t py_rect_locals_dict_table[] = { +static const mp_rom_map_elem_t py_rect_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_corners), MP_ROM_PTR(&py_rect_corners_obj) }, { MP_ROM_QSTR(MP_QSTR_rect), MP_ROM_PTR(&py_rect_rect_obj) }, { MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&py_rect_x_obj) }, @@ -4848,9 +4848,9 @@ STATIC const mp_rom_map_elem_t py_rect_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_magnitude), MP_ROM_PTR(&py_rect_magnitude_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_rect_locals_dict, py_rect_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_rect_locals_dict, py_rect_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_rect_type, MP_QSTR_rect, MP_TYPE_FLAG_NONE, @@ -4903,7 +4903,7 @@ static mp_obj_t py_image_find_rects(uint n_args, const mp_obj_t *args, mp_map_t return objects_list; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_rects_obj, 1, py_image_find_rects); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_rects_obj, 1, py_image_find_rects); #endif // IMLIB_ENABLE_FIND_RECTS #ifdef IMLIB_ENABLE_QRCODES @@ -4964,7 +4964,7 @@ static mp_obj_t py_qrcode_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t valu mp_obj_t py_qrcode_corners(mp_obj_t self_in) { return ((py_qrcode_obj_t *) self_in)->corners; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_corners_obj, py_qrcode_corners); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_corners_obj, py_qrcode_corners); mp_obj_t py_qrcode_rect(mp_obj_t self_in) { return mp_obj_new_tuple(4, (mp_obj_t []) {((py_qrcode_obj_t *) self_in)->x, @@ -4972,79 +4972,79 @@ mp_obj_t py_qrcode_rect(mp_obj_t self_in) { ((py_qrcode_obj_t *) self_in)->w, ((py_qrcode_obj_t *) self_in)->h}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_rect_obj, py_qrcode_rect); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_rect_obj, py_qrcode_rect); mp_obj_t py_qrcode_x(mp_obj_t self_in) { return ((py_qrcode_obj_t *) self_in)->x; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_x_obj, py_qrcode_x); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_x_obj, py_qrcode_x); mp_obj_t py_qrcode_y(mp_obj_t self_in) { return ((py_qrcode_obj_t *) self_in)->y; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_y_obj, py_qrcode_y); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_y_obj, py_qrcode_y); mp_obj_t py_qrcode_w(mp_obj_t self_in) { return ((py_qrcode_obj_t *) self_in)->w; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_w_obj, py_qrcode_w); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_w_obj, py_qrcode_w); mp_obj_t py_qrcode_h(mp_obj_t self_in) { return ((py_qrcode_obj_t *) self_in)->h; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_h_obj, py_qrcode_h); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_h_obj, py_qrcode_h); mp_obj_t py_qrcode_payload(mp_obj_t self_in) { return ((py_qrcode_obj_t *) self_in)->payload; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_payload_obj, py_qrcode_payload); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_payload_obj, py_qrcode_payload); mp_obj_t py_qrcode_version(mp_obj_t self_in) { return ((py_qrcode_obj_t *) self_in)->version; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_version_obj, py_qrcode_version); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_version_obj, py_qrcode_version); mp_obj_t py_qrcode_ecc_level(mp_obj_t self_in) { return ((py_qrcode_obj_t *) self_in)->ecc_level; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_ecc_level_obj, py_qrcode_ecc_level); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_ecc_level_obj, py_qrcode_ecc_level); mp_obj_t py_qrcode_mask(mp_obj_t self_in) { return ((py_qrcode_obj_t *) self_in)->mask; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_mask_obj, py_qrcode_mask); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_mask_obj, py_qrcode_mask); mp_obj_t py_qrcode_data_type(mp_obj_t self_in) { return ((py_qrcode_obj_t *) self_in)->data_type; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_data_type_obj, py_qrcode_data_type); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_data_type_obj, py_qrcode_data_type); mp_obj_t py_qrcode_eci(mp_obj_t self_in) { return ((py_qrcode_obj_t *) self_in)->eci; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_eci_obj, py_qrcode_eci); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_eci_obj, py_qrcode_eci); mp_obj_t py_qrcode_is_numeric(mp_obj_t self_in) { return mp_obj_new_bool(mp_obj_get_int(((py_qrcode_obj_t *) self_in)->data_type) == 1); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_is_numeric_obj, py_qrcode_is_numeric); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_is_numeric_obj, py_qrcode_is_numeric); mp_obj_t py_qrcode_is_alphanumeric(mp_obj_t self_in) { return mp_obj_new_bool(mp_obj_get_int(((py_qrcode_obj_t *) self_in)->data_type) == 2); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_is_alphanumeric_obj, py_qrcode_is_alphanumeric); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_is_alphanumeric_obj, py_qrcode_is_alphanumeric); mp_obj_t py_qrcode_is_binary(mp_obj_t self_in) { return mp_obj_new_bool(mp_obj_get_int(((py_qrcode_obj_t *) self_in)->data_type) == 4); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_is_binary_obj, py_qrcode_is_binary); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_is_binary_obj, py_qrcode_is_binary); mp_obj_t py_qrcode_is_kanji(mp_obj_t self_in) { return mp_obj_new_bool(mp_obj_get_int(((py_qrcode_obj_t *) self_in)->data_type) == 8); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_is_kanji_obj, py_qrcode_is_kanji); +static MP_DEFINE_CONST_FUN_OBJ_1(py_qrcode_is_kanji_obj, py_qrcode_is_kanji); -STATIC const mp_rom_map_elem_t py_qrcode_locals_dict_table[] = { +static const mp_rom_map_elem_t py_qrcode_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_corners), MP_ROM_PTR(&py_qrcode_corners_obj) }, { MP_ROM_QSTR(MP_QSTR_rect), MP_ROM_PTR(&py_qrcode_rect_obj) }, { MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&py_qrcode_x_obj) }, @@ -5063,9 +5063,9 @@ STATIC const mp_rom_map_elem_t py_qrcode_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_is_kanji), MP_ROM_PTR(&py_qrcode_is_kanji_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_qrcode_locals_dict, py_qrcode_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_qrcode_locals_dict, py_qrcode_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_qrcode_type, MP_QSTR_qrcode, MP_TYPE_FLAG_NONE, @@ -5122,7 +5122,7 @@ static mp_obj_t py_image_find_qrcodes(uint n_args, const mp_obj_t *args, mp_map_ return objects_list; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_qrcodes_obj, 1, py_image_find_qrcodes); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_qrcodes_obj, 1, py_image_find_qrcodes); #endif // IMLIB_ENABLE_QRCODES #ifdef IMLIB_ENABLE_APRILTAGS @@ -5203,7 +5203,7 @@ static mp_obj_t py_apriltag_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t va mp_obj_t py_apriltag_corners(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->corners; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_corners_obj, py_apriltag_corners); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_corners_obj, py_apriltag_corners); mp_obj_t py_apriltag_rect(mp_obj_t self_in) { return mp_obj_new_tuple(4, (mp_obj_t []) {((py_apriltag_obj_t *) self_in)->x, @@ -5211,109 +5211,109 @@ mp_obj_t py_apriltag_rect(mp_obj_t self_in) { ((py_apriltag_obj_t *) self_in)->w, ((py_apriltag_obj_t *) self_in)->h}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_rect_obj, py_apriltag_rect); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_rect_obj, py_apriltag_rect); mp_obj_t py_apriltag_x(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->x; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_x_obj, py_apriltag_x); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_x_obj, py_apriltag_x); mp_obj_t py_apriltag_y(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->y; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_y_obj, py_apriltag_y); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_y_obj, py_apriltag_y); mp_obj_t py_apriltag_w(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->w; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_w_obj, py_apriltag_w); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_w_obj, py_apriltag_w); mp_obj_t py_apriltag_h(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->h; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_h_obj, py_apriltag_h); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_h_obj, py_apriltag_h); mp_obj_t py_apriltag_id(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->id; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_id_obj, py_apriltag_id); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_id_obj, py_apriltag_id); mp_obj_t py_apriltag_family(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->family; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_family_obj, py_apriltag_family); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_family_obj, py_apriltag_family); mp_obj_t py_apriltag_cx(mp_obj_t self_in) { return mp_obj_new_int(fast_roundf(mp_obj_get_float(((py_apriltag_obj_t *) self_in)->cx))); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_cx_obj, py_apriltag_cx); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_cx_obj, py_apriltag_cx); mp_obj_t py_apriltag_cxf(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->cx; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_cxf_obj, py_apriltag_cxf); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_cxf_obj, py_apriltag_cxf); mp_obj_t py_apriltag_cy(mp_obj_t self_in) { return mp_obj_new_int(fast_roundf(mp_obj_get_float(((py_apriltag_obj_t *) self_in)->cy))); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_cy_obj, py_apriltag_cy); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_cy_obj, py_apriltag_cy); mp_obj_t py_apriltag_cyf(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->cy; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_cyf_obj, py_apriltag_cyf); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_cyf_obj, py_apriltag_cyf); mp_obj_t py_apriltag_rotation(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->rotation; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_rotation_obj, py_apriltag_rotation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_rotation_obj, py_apriltag_rotation); mp_obj_t py_apriltag_decision_margin(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->decision_margin; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_decision_margin_obj, py_apriltag_decision_margin); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_decision_margin_obj, py_apriltag_decision_margin); mp_obj_t py_apriltag_hamming(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->hamming; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_hamming_obj, py_apriltag_hamming); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_hamming_obj, py_apriltag_hamming); mp_obj_t py_apriltag_goodness(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->goodness; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_goodness_obj, py_apriltag_goodness); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_goodness_obj, py_apriltag_goodness); mp_obj_t py_apriltag_x_translation(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->x_translation; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_x_translation_obj, py_apriltag_x_translation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_x_translation_obj, py_apriltag_x_translation); mp_obj_t py_apriltag_y_translation(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->y_translation; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_y_translation_obj, py_apriltag_y_translation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_y_translation_obj, py_apriltag_y_translation); mp_obj_t py_apriltag_z_translation(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->z_translation; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_z_translation_obj, py_apriltag_z_translation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_z_translation_obj, py_apriltag_z_translation); mp_obj_t py_apriltag_x_rotation(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->x_rotation; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_x_rotation_obj, py_apriltag_x_rotation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_x_rotation_obj, py_apriltag_x_rotation); mp_obj_t py_apriltag_y_rotation(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->y_rotation; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_y_rotation_obj, py_apriltag_y_rotation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_y_rotation_obj, py_apriltag_y_rotation); mp_obj_t py_apriltag_z_rotation(mp_obj_t self_in) { return ((py_apriltag_obj_t *) self_in)->z_rotation; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_z_rotation_obj, py_apriltag_z_rotation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_apriltag_z_rotation_obj, py_apriltag_z_rotation); -STATIC const mp_rom_map_elem_t py_apriltag_locals_dict_table[] = { +static const mp_rom_map_elem_t py_apriltag_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_corners), MP_ROM_PTR(&py_apriltag_corners_obj) }, { MP_ROM_QSTR(MP_QSTR_rect), MP_ROM_PTR(&py_apriltag_rect_obj) }, { MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&py_apriltag_x_obj) }, @@ -5338,9 +5338,9 @@ STATIC const mp_rom_map_elem_t py_apriltag_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_z_rotation), MP_ROM_PTR(&py_apriltag_z_rotation_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_apriltag_locals_dict, py_apriltag_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_apriltag_locals_dict, py_apriltag_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_apriltag_type, MP_QSTR_apriltag, MP_TYPE_FLAG_NONE, @@ -5420,7 +5420,7 @@ static mp_obj_t py_image_find_apriltags(uint n_args, const mp_obj_t *args, mp_ma return objects_list; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_apriltags_obj, 1, py_image_find_apriltags); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_apriltags_obj, 1, py_image_find_apriltags); #endif // IMLIB_ENABLE_APRILTAGS #ifdef IMLIB_ENABLE_DATAMATRICES @@ -5481,7 +5481,7 @@ static mp_obj_t py_datamatrix_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t mp_obj_t py_datamatrix_corners(mp_obj_t self_in) { return ((py_datamatrix_obj_t *) self_in)->corners; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_corners_obj, py_datamatrix_corners); +static MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_corners_obj, py_datamatrix_corners); mp_obj_t py_datamatrix_rect(mp_obj_t self_in) { return mp_obj_new_tuple(4, (mp_obj_t []) {((py_datamatrix_obj_t *) self_in)->x, @@ -5489,59 +5489,59 @@ mp_obj_t py_datamatrix_rect(mp_obj_t self_in) { ((py_datamatrix_obj_t *) self_in)->w, ((py_datamatrix_obj_t *) self_in)->h}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_rect_obj, py_datamatrix_rect); +static MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_rect_obj, py_datamatrix_rect); mp_obj_t py_datamatrix_x(mp_obj_t self_in) { return ((py_datamatrix_obj_t *) self_in)->x; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_x_obj, py_datamatrix_x); +static MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_x_obj, py_datamatrix_x); mp_obj_t py_datamatrix_y(mp_obj_t self_in) { return ((py_datamatrix_obj_t *) self_in)->y; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_y_obj, py_datamatrix_y); +static MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_y_obj, py_datamatrix_y); mp_obj_t py_datamatrix_w(mp_obj_t self_in) { return ((py_datamatrix_obj_t *) self_in)->w; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_w_obj, py_datamatrix_w); +static MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_w_obj, py_datamatrix_w); mp_obj_t py_datamatrix_h(mp_obj_t self_in) { return ((py_datamatrix_obj_t *) self_in)->h; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_h_obj, py_datamatrix_h); +static MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_h_obj, py_datamatrix_h); mp_obj_t py_datamatrix_payload(mp_obj_t self_in) { return ((py_datamatrix_obj_t *) self_in)->payload; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_payload_obj, py_datamatrix_payload); +static MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_payload_obj, py_datamatrix_payload); mp_obj_t py_datamatrix_rotation(mp_obj_t self_in) { return ((py_datamatrix_obj_t *) self_in)->rotation; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_rotation_obj, py_datamatrix_rotation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_rotation_obj, py_datamatrix_rotation); mp_obj_t py_datamatrix_rows(mp_obj_t self_in) { return ((py_datamatrix_obj_t *) self_in)->rows; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_rows_obj, py_datamatrix_rows); +static MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_rows_obj, py_datamatrix_rows); mp_obj_t py_datamatrix_columns(mp_obj_t self_in) { return ((py_datamatrix_obj_t *) self_in)->columns; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_columns_obj, py_datamatrix_columns); +static MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_columns_obj, py_datamatrix_columns); mp_obj_t py_datamatrix_capacity(mp_obj_t self_in) { return ((py_datamatrix_obj_t *) self_in)->capacity; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_capacity_obj, py_datamatrix_capacity); +static MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_capacity_obj, py_datamatrix_capacity); mp_obj_t py_datamatrix_padding(mp_obj_t self_in) { return ((py_datamatrix_obj_t *) self_in)->padding; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_padding_obj, py_datamatrix_padding); +static MP_DEFINE_CONST_FUN_OBJ_1(py_datamatrix_padding_obj, py_datamatrix_padding); -STATIC const mp_rom_map_elem_t py_datamatrix_locals_dict_table[] = { +static const mp_rom_map_elem_t py_datamatrix_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_corners), MP_ROM_PTR(&py_datamatrix_corners_obj) }, { MP_ROM_QSTR(MP_QSTR_rect), MP_ROM_PTR(&py_datamatrix_rect_obj) }, { MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&py_datamatrix_x_obj) }, @@ -5556,9 +5556,9 @@ STATIC const mp_rom_map_elem_t py_datamatrix_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_padding), MP_ROM_PTR(&py_datamatrix_padding_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_datamatrix_locals_dict, py_datamatrix_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_datamatrix_locals_dict, py_datamatrix_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_datamatrix_type, MP_QSTR_datamatrix, MP_TYPE_FLAG_NONE, @@ -5617,7 +5617,7 @@ static mp_obj_t py_image_find_datamatrices(uint n_args, const mp_obj_t *args, mp return objects_list; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_datamatrices_obj, 1, py_image_find_datamatrices); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_datamatrices_obj, 1, py_image_find_datamatrices); #endif // IMLIB_ENABLE_DATAMATRICES #ifdef IMLIB_ENABLE_BARCODES @@ -5674,7 +5674,7 @@ static mp_obj_t py_barcode_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t val mp_obj_t py_barcode_corners(mp_obj_t self_in) { return ((py_barcode_obj_t *) self_in)->corners; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_corners_obj, py_barcode_corners); +static MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_corners_obj, py_barcode_corners); mp_obj_t py_barcode_rect(mp_obj_t self_in) { return mp_obj_new_tuple(4, (mp_obj_t []) {((py_barcode_obj_t *) self_in)->x, @@ -5682,49 +5682,49 @@ mp_obj_t py_barcode_rect(mp_obj_t self_in) { ((py_barcode_obj_t *) self_in)->w, ((py_barcode_obj_t *) self_in)->h}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_rect_obj, py_barcode_rect); +static MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_rect_obj, py_barcode_rect); mp_obj_t py_barcode_x(mp_obj_t self_in) { return ((py_barcode_obj_t *) self_in)->x; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_x_obj, py_barcode_x); +static MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_x_obj, py_barcode_x); mp_obj_t py_barcode_y(mp_obj_t self_in) { return ((py_barcode_obj_t *) self_in)->y; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_y_obj, py_barcode_y); +static MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_y_obj, py_barcode_y); mp_obj_t py_barcode_w(mp_obj_t self_in) { return ((py_barcode_obj_t *) self_in)->w; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_w_obj, py_barcode_w); +static MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_w_obj, py_barcode_w); mp_obj_t py_barcode_h(mp_obj_t self_in) { return ((py_barcode_obj_t *) self_in)->h; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_h_obj, py_barcode_h); +static MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_h_obj, py_barcode_h); mp_obj_t py_barcode_payload_fun(mp_obj_t self_in) { return ((py_barcode_obj_t *) self_in)->payload; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_payload_fun_obj, py_barcode_payload_fun); +static MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_payload_fun_obj, py_barcode_payload_fun); mp_obj_t py_barcode_type_fun(mp_obj_t self_in) { return ((py_barcode_obj_t *) self_in)->type; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_type_fun_obj, py_barcode_type_fun); +static MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_type_fun_obj, py_barcode_type_fun); mp_obj_t py_barcode_rotation_fun(mp_obj_t self_in) { return ((py_barcode_obj_t *) self_in)->rotation; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_rotation_fun_obj, py_barcode_rotation_fun); +static MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_rotation_fun_obj, py_barcode_rotation_fun); mp_obj_t py_barcode_quality_fun(mp_obj_t self_in) { return ((py_barcode_obj_t *) self_in)->quality; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_quality_fun_obj, py_barcode_quality_fun); +static MP_DEFINE_CONST_FUN_OBJ_1(py_barcode_quality_fun_obj, py_barcode_quality_fun); -STATIC const mp_rom_map_elem_t py_barcode_locals_dict_table[] = { +static const mp_rom_map_elem_t py_barcode_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_corners), MP_ROM_PTR(&py_barcode_corners_obj) }, { MP_ROM_QSTR(MP_QSTR_rect), MP_ROM_PTR(&py_barcode_rect_obj) }, { MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&py_barcode_x_obj) }, @@ -5737,9 +5737,9 @@ STATIC const mp_rom_map_elem_t py_barcode_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_quality), MP_ROM_PTR(&py_barcode_quality_fun_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_barcode_locals_dict, py_barcode_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_barcode_locals_dict, py_barcode_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_barcode_type, MP_QSTR_barcode, MP_TYPE_FLAG_NONE, @@ -5794,7 +5794,7 @@ static mp_obj_t py_image_find_barcodes(uint n_args, const mp_obj_t *args, mp_map return objects_list; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_barcodes_obj, 1, py_image_find_barcodes); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_barcodes_obj, 1, py_image_find_barcodes); #endif // IMLIB_ENABLE_BARCODES #ifdef IMLIB_ENABLE_FIND_DISPLACEMENT @@ -5843,29 +5843,29 @@ static mp_obj_t py_displacement_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_ mp_obj_t py_displacement_x_translation(mp_obj_t self_in) { return ((py_displacement_obj_t *) self_in)->x_translation; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_displacement_x_translation_obj, py_displacement_x_translation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_displacement_x_translation_obj, py_displacement_x_translation); mp_obj_t py_displacement_y_translation(mp_obj_t self_in) { return ((py_displacement_obj_t *) self_in)->y_translation; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_displacement_y_translation_obj, py_displacement_y_translation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_displacement_y_translation_obj, py_displacement_y_translation); mp_obj_t py_displacement_rotation(mp_obj_t self_in) { return ((py_displacement_obj_t *) self_in)->rotation; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_displacement_rotation_obj, py_displacement_rotation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_displacement_rotation_obj, py_displacement_rotation); mp_obj_t py_displacement_scale(mp_obj_t self_in) { return ((py_displacement_obj_t *) self_in)->scale; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_displacement_scale_obj, py_displacement_scale); +static MP_DEFINE_CONST_FUN_OBJ_1(py_displacement_scale_obj, py_displacement_scale); mp_obj_t py_displacement_response(mp_obj_t self_in) { return ((py_displacement_obj_t *) self_in)->response; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_displacement_response_obj, py_displacement_response); +static MP_DEFINE_CONST_FUN_OBJ_1(py_displacement_response_obj, py_displacement_response); -STATIC const mp_rom_map_elem_t py_displacement_locals_dict_table[] = { +static const mp_rom_map_elem_t py_displacement_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_x_translation), MP_ROM_PTR(&py_displacement_x_translation_obj) }, { MP_ROM_QSTR(MP_QSTR_y_translation), MP_ROM_PTR(&py_displacement_y_translation_obj) }, { MP_ROM_QSTR(MP_QSTR_rotation), MP_ROM_PTR(&py_displacement_rotation_obj) }, @@ -5873,9 +5873,9 @@ STATIC const mp_rom_map_elem_t py_displacement_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_response), MP_ROM_PTR(&py_displacement_response_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_displacement_locals_dict, py_displacement_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_displacement_locals_dict, py_displacement_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_displacement_type, MP_QSTR_displacement, MP_TYPE_FLAG_NONE, @@ -5917,7 +5917,7 @@ static mp_obj_t py_image_find_displacement(uint n_args, const mp_obj_t *args, mp return o; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_displacement_obj, 2, py_image_find_displacement); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_displacement_obj, 2, py_image_find_displacement); #endif // IMLIB_ENABLE_FIND_DISPLACEMENT #ifdef IMLIB_FIND_TEMPLATE @@ -5962,7 +5962,7 @@ static mp_obj_t py_image_find_template(uint n_args, const mp_obj_t *args, mp_map } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_template_obj, 3, py_image_find_template); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_template_obj, 3, py_image_find_template); #endif // IMLIB_FIND_TEMPLATE #ifdef IMLIB_ENABLE_FEATURES @@ -5999,7 +5999,7 @@ static mp_obj_t py_image_find_features(uint n_args, const mp_obj_t *args, mp_map array_free(objects_array); return objects_list; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_features_obj, 2, py_image_find_features); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_features_obj, 2, py_image_find_features); #endif // IMLIB_ENABLE_FEATURES static mp_obj_t py_image_find_eye(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { @@ -6018,7 +6018,7 @@ static mp_obj_t py_image_find_eye(uint n_args, const mp_obj_t *args, mp_map_t *k return mp_obj_new_tuple(2, eye_obj); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_eye_obj, 2, py_image_find_eye); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_eye_obj, 2, py_image_find_eye); #ifdef IMLIB_ENABLE_FIND_LBP static mp_obj_t py_image_find_lbp(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { @@ -6032,7 +6032,7 @@ static mp_obj_t py_image_find_lbp(uint n_args, const mp_obj_t *args, mp_map_t *k lbp_obj->hist = imlib_lbp_desc(arg_img, &roi); return lbp_obj; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_lbp_obj, 2, py_image_find_lbp); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_lbp_obj, 2, py_image_find_lbp); #endif // IMLIB_ENABLE_FIND_LBP #ifdef IMLIB_ENABLE_FIND_KEYPOINTS @@ -6073,7 +6073,7 @@ static mp_obj_t py_image_find_keypoints(uint n_args, const mp_obj_t *args, mp_ma } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_keypoints_obj, 1, py_image_find_keypoints); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_keypoints_obj, 1, py_image_find_keypoints); #endif // IMLIB_ENABLE_FIND_KEYPOINTS #ifdef IMLIB_ENABLE_BINARY_OPS @@ -6112,7 +6112,7 @@ static mp_obj_t py_image_find_edges(uint n_args, const mp_obj_t *args, mp_map_t return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_edges_obj, 2, py_image_find_edges); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_edges_obj, 2, py_image_find_edges); #endif #ifdef IMLIB_ENABLE_HOG @@ -6130,7 +6130,7 @@ static mp_obj_t py_image_find_hog(uint n_args, const mp_obj_t *args, mp_map_t *k return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_hog_obj, 1, py_image_find_hog); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_find_hog_obj, 1, py_image_find_hog); #endif // IMLIB_ENABLE_HOG #ifdef IMLIB_ENABLE_SELECTIVE_SEARCH @@ -6159,7 +6159,7 @@ static mp_obj_t py_image_selective_search(uint n_args, const mp_obj_t *args, mp_ array_free(proposals_array); return proposals_list; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_selective_search_obj, 1, py_image_selective_search); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_selective_search_obj, 1, py_image_selective_search); #endif // IMLIB_ENABLE_SELECTIVE_SEARCH #ifdef IMLIB_ENABLE_STEREO_DISPARITY @@ -6188,7 +6188,7 @@ static mp_obj_t py_image_stereo_disparity(uint n_args, const mp_obj_t *args, mp_ return args[0]; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_stereo_disparity_obj, 1, py_image_stereo_disparity); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_stereo_disparity_obj, 1, py_image_stereo_disparity); #endif // IMLIB_ENABLE_STEREO_DISPARITY static const mp_rom_map_elem_t locals_dict_table[] = { @@ -6490,7 +6490,7 @@ static const mp_rom_map_elem_t locals_dict_table[] = { #endif }; -STATIC MP_DEFINE_CONST_DICT(py_image_locals_dict, locals_dict_table); +static MP_DEFINE_CONST_DICT(py_image_locals_dict, locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( py_image_type, @@ -6508,7 +6508,7 @@ mp_obj_t py_image_binary_to_grayscale(mp_obj_t arg) { int8_t b = mp_obj_get_int(arg) & 1; return mp_obj_new_int(COLOR_BINARY_TO_GRAYSCALE(b)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_binary_to_grayscale_obj, py_image_binary_to_grayscale); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_binary_to_grayscale_obj, py_image_binary_to_grayscale); mp_obj_t py_image_binary_to_rgb(mp_obj_t arg) { int8_t b = mp_obj_get_int(arg) & 1; @@ -6518,7 +6518,7 @@ mp_obj_t py_image_binary_to_rgb(mp_obj_t arg) { mp_obj_new_int(COLOR_RGB565_TO_G8(rgb565)), mp_obj_new_int(COLOR_RGB565_TO_B8(rgb565))}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_binary_to_rgb_obj, py_image_binary_to_rgb); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_binary_to_rgb_obj, py_image_binary_to_rgb); mp_obj_t py_image_binary_to_lab(mp_obj_t arg) { int8_t b = mp_obj_get_int(arg) & 1; @@ -6528,7 +6528,7 @@ mp_obj_t py_image_binary_to_lab(mp_obj_t arg) { mp_obj_new_int(COLOR_RGB565_TO_A(rgb565)), mp_obj_new_int(COLOR_RGB565_TO_B(rgb565))}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_binary_to_lab_obj, py_image_binary_to_lab); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_binary_to_lab_obj, py_image_binary_to_lab); mp_obj_t py_image_binary_to_yuv(mp_obj_t arg) { int8_t b = mp_obj_get_int(arg) & 1; @@ -6538,13 +6538,13 @@ mp_obj_t py_image_binary_to_yuv(mp_obj_t arg) { mp_obj_new_int(COLOR_RGB565_TO_U(rgb565)), mp_obj_new_int(COLOR_RGB565_TO_V(rgb565))}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_binary_to_yuv_obj, py_image_binary_to_yuv); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_binary_to_yuv_obj, py_image_binary_to_yuv); mp_obj_t py_image_grayscale_to_binary(mp_obj_t arg) { int8_t g = mp_obj_get_int(arg) & 255; return mp_obj_new_int(COLOR_GRAYSCALE_TO_BINARY(g)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_grayscale_to_binary_obj, py_image_grayscale_to_binary); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_grayscale_to_binary_obj, py_image_grayscale_to_binary); mp_obj_t py_image_grayscale_to_rgb(mp_obj_t arg) { int8_t g = mp_obj_get_int(arg) & 255; @@ -6554,7 +6554,7 @@ mp_obj_t py_image_grayscale_to_rgb(mp_obj_t arg) { mp_obj_new_int(COLOR_RGB565_TO_G8(rgb565)), mp_obj_new_int(COLOR_RGB565_TO_B8(rgb565))}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_grayscale_to_rgb_obj, py_image_grayscale_to_rgb); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_grayscale_to_rgb_obj, py_image_grayscale_to_rgb); mp_obj_t py_image_grayscale_to_lab(mp_obj_t arg) { int8_t g = mp_obj_get_int(arg) & 255; @@ -6564,7 +6564,7 @@ mp_obj_t py_image_grayscale_to_lab(mp_obj_t arg) { mp_obj_new_int(COLOR_RGB565_TO_A(rgb565)), mp_obj_new_int(COLOR_RGB565_TO_B(rgb565))}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_grayscale_to_lab_obj, py_image_grayscale_to_lab); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_grayscale_to_lab_obj, py_image_grayscale_to_lab); mp_obj_t py_image_grayscale_to_yuv(mp_obj_t arg) { int8_t g = mp_obj_get_int(arg) & 255; @@ -6574,7 +6574,7 @@ mp_obj_t py_image_grayscale_to_yuv(mp_obj_t arg) { mp_obj_new_int(COLOR_RGB565_TO_U(rgb565)), mp_obj_new_int(COLOR_RGB565_TO_V(rgb565))}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_grayscale_to_yuv_obj, py_image_grayscale_to_yuv); +static MP_DEFINE_CONST_FUN_OBJ_1(py_image_grayscale_to_yuv_obj, py_image_grayscale_to_yuv); mp_obj_t py_image_rgb_to_binary(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { const mp_obj_t *arg_vec; @@ -6585,7 +6585,7 @@ mp_obj_t py_image_rgb_to_binary(uint n_args, const mp_obj_t *args, mp_map_t *kw_ uint16_t rgb565 = COLOR_R8_G8_B8_TO_RGB565(r, g, b); return mp_obj_new_int(COLOR_RGB565_TO_BINARY(rgb565)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rgb_to_binary_obj, 1, py_image_rgb_to_binary); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rgb_to_binary_obj, 1, py_image_rgb_to_binary); mp_obj_t py_image_rgb_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { const mp_obj_t *arg_vec; @@ -6596,7 +6596,7 @@ mp_obj_t py_image_rgb_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_t * uint16_t rgb565 = COLOR_R8_G8_B8_TO_RGB565(r, g, b); return mp_obj_new_int(COLOR_RGB565_TO_GRAYSCALE(rgb565)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rgb_to_grayscale_obj, 1, py_image_rgb_to_grayscale); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rgb_to_grayscale_obj, 1, py_image_rgb_to_grayscale); mp_obj_t py_image_rgb_to_lab(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { const mp_obj_t *arg_vec; @@ -6610,7 +6610,7 @@ mp_obj_t py_image_rgb_to_lab(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg mp_obj_new_int(COLOR_RGB565_TO_A(rgb565)), mp_obj_new_int(COLOR_RGB565_TO_B(rgb565))}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rgb_to_lab_obj, 1, py_image_rgb_to_lab); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rgb_to_lab_obj, 1, py_image_rgb_to_lab); mp_obj_t py_image_rgb_to_yuv(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { const mp_obj_t *arg_vec; @@ -6624,7 +6624,7 @@ mp_obj_t py_image_rgb_to_yuv(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg mp_obj_new_int(COLOR_RGB565_TO_U(rgb565)), mp_obj_new_int(COLOR_RGB565_TO_V(rgb565))}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rgb_to_yuv_obj, 1, py_image_rgb_to_yuv); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_rgb_to_yuv_obj, 1, py_image_rgb_to_yuv); mp_obj_t py_image_lab_to_binary(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { const mp_obj_t *arg_vec; @@ -6635,7 +6635,7 @@ mp_obj_t py_image_lab_to_binary(uint n_args, const mp_obj_t *args, mp_map_t *kw_ uint16_t rgb565 = COLOR_LAB_TO_RGB565(l, a, b); return mp_obj_new_int(COLOR_RGB565_TO_BINARY(rgb565)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lab_to_binary_obj, 1, py_image_lab_to_binary); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lab_to_binary_obj, 1, py_image_lab_to_binary); mp_obj_t py_image_lab_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { const mp_obj_t *arg_vec; @@ -6646,7 +6646,7 @@ mp_obj_t py_image_lab_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_t * uint16_t rgb565 = COLOR_LAB_TO_RGB565(l, a, b); return mp_obj_new_int(COLOR_RGB565_TO_GRAYSCALE(rgb565)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lab_to_grayscale_obj, 1, py_image_lab_to_grayscale); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lab_to_grayscale_obj, 1, py_image_lab_to_grayscale); mp_obj_t py_image_lab_to_rgb(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { const mp_obj_t *arg_vec; @@ -6660,7 +6660,7 @@ mp_obj_t py_image_lab_to_rgb(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg mp_obj_new_int(COLOR_RGB565_TO_G8(rgb565)), mp_obj_new_int(COLOR_RGB565_TO_B8(rgb565))}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lab_to_rgb_obj, 1, py_image_lab_to_rgb); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lab_to_rgb_obj, 1, py_image_lab_to_rgb); mp_obj_t py_image_lab_to_yuv(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { const mp_obj_t *arg_vec; @@ -6674,7 +6674,7 @@ mp_obj_t py_image_lab_to_yuv(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg mp_obj_new_int(COLOR_RGB565_TO_U(rgb565)), mp_obj_new_int(COLOR_RGB565_TO_V(rgb565))}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lab_to_yuv_obj, 1, py_image_lab_to_yuv); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_lab_to_yuv_obj, 1, py_image_lab_to_yuv); mp_obj_t py_image_yuv_to_binary(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { const mp_obj_t *arg_vec; @@ -6685,7 +6685,7 @@ mp_obj_t py_image_yuv_to_binary(uint n_args, const mp_obj_t *args, mp_map_t *kw_ uint16_t rgb565 = COLOR_YUV_TO_RGB565(y, u, v); return mp_obj_new_int(COLOR_RGB565_TO_BINARY(rgb565)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_yuv_to_binary_obj, 1, py_image_yuv_to_binary); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_yuv_to_binary_obj, 1, py_image_yuv_to_binary); mp_obj_t py_image_yuv_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { const mp_obj_t *arg_vec; @@ -6696,7 +6696,7 @@ mp_obj_t py_image_yuv_to_grayscale(uint n_args, const mp_obj_t *args, mp_map_t * uint16_t rgb565 = COLOR_YUV_TO_RGB565(y, u, v); return mp_obj_new_int(COLOR_RGB565_TO_GRAYSCALE(rgb565)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_yuv_to_grayscale_obj, 1, py_image_yuv_to_grayscale); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_yuv_to_grayscale_obj, 1, py_image_yuv_to_grayscale); mp_obj_t py_image_yuv_to_rgb(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { const mp_obj_t *arg_vec; @@ -6710,7 +6710,7 @@ mp_obj_t py_image_yuv_to_rgb(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg mp_obj_new_int(COLOR_RGB565_TO_G8(rgb565)), mp_obj_new_int(COLOR_RGB565_TO_B8(rgb565))}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_yuv_to_rgb_obj, 1, py_image_yuv_to_rgb); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_yuv_to_rgb_obj, 1, py_image_yuv_to_rgb); mp_obj_t py_image_yuv_to_lab(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { const mp_obj_t *arg_vec; @@ -6724,7 +6724,7 @@ mp_obj_t py_image_yuv_to_lab(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg mp_obj_new_int(COLOR_RGB565_TO_A(rgb565)), mp_obj_new_int(COLOR_RGB565_TO_B(rgb565))}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_yuv_to_lab_obj, 1, py_image_yuv_to_lab); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_yuv_to_lab_obj, 1, py_image_yuv_to_lab); mp_obj_t py_image(int w, int h, pixformat_t pixfmt, uint32_t size, void *pixels) { py_image_obj_t *o = m_new_obj(py_image_obj_t); @@ -6909,7 +6909,7 @@ mp_obj_t py_image_load_image(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw } return py_image_from_struct(&image); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_load_image_obj, 1, py_image_load_image); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_load_image_obj, 1, py_image_load_image); #ifdef IMLIB_ENABLE_FEATURES mp_obj_t py_image_load_cascade(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { @@ -6941,7 +6941,7 @@ mp_obj_t py_image_load_cascade(uint n_args, const mp_obj_t *args, mp_map_t *kw_a o->_cobj = cascade; return o; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_load_cascade_obj, 1, py_image_load_cascade); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_load_cascade_obj, 1, py_image_load_cascade); #endif // IMLIB_ENABLE_FEATURES #if defined(IMLIB_ENABLE_DESCRIPTOR) @@ -7006,7 +7006,7 @@ mp_obj_t py_image_load_descriptor(uint n_args, const mp_obj_t *args, mp_map_t *k } return desc; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_load_descriptor_obj, 1, py_image_load_descriptor); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_load_descriptor_obj, 1, py_image_load_descriptor); mp_obj_t py_image_save_descriptor(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { FIL fp; @@ -7063,7 +7063,7 @@ mp_obj_t py_image_save_descriptor(uint n_args, const mp_obj_t *args, mp_map_t *k } return mp_const_true; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_save_descriptor_obj, 2, py_image_save_descriptor); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_save_descriptor_obj, 2, py_image_save_descriptor); #endif //IMLIB_ENABLE_IMAGE_FILE_IO static mp_obj_t py_image_match_descriptor(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { @@ -7147,7 +7147,7 @@ static mp_obj_t py_image_match_descriptor(uint n_args, const mp_obj_t *args, mp_ return match_obj; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_match_descriptor_obj, 2, py_image_match_descriptor); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_image_match_descriptor_obj, 2, py_image_match_descriptor); #endif //IMLIB_ENABLE_DESCRIPTOR #if defined(IMLIB_ENABLE_FIND_KEYPOINTS) && defined(IMLIB_ENABLE_IMAGE_FILE_IO) @@ -7275,7 +7275,7 @@ static const mp_rom_map_elem_t globals_dict_table[] = { #endif }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t image_module = { .base = { &mp_type_module }, diff --git a/src/omv/modules/py_imageio.c b/src/omv/modules/py_imageio.c index c8ede2b76..8e311414f 100644 --- a/src/omv/modules/py_imageio.c +++ b/src/omv/modules/py_imageio.c @@ -51,7 +51,7 @@ / (IMAGE_ALIGNMENT)) \ * (IMAGE_ALIGNMENT)) -STATIC size_t image_size_aligned(image_t *image) { +static size_t image_size_aligned(image_t *image) { return ((image_size(image) + (IMAGE_ALIGNMENT) -1) / (IMAGE_ALIGNMENT)) * (IMAGE_ALIGNMENT); } @@ -81,7 +81,7 @@ typedef struct py_imageio_obj { }; } py_imageio_obj_t; -STATIC py_imageio_obj_t *py_imageio_obj(mp_obj_t self) { +static py_imageio_obj_t *py_imageio_obj(mp_obj_t self) { py_imageio_obj_t *stream = MP_OBJ_TO_PTR(self); if (stream->closed) { @@ -91,7 +91,7 @@ STATIC py_imageio_obj_t *py_imageio_obj(mp_obj_t self) { return stream; } -STATIC void py_imageio_print(const mp_print_t *print, mp_obj_t self, mp_print_kind_t kind) { +static void py_imageio_print(const mp_print_t *print, mp_obj_t self, mp_print_kind_t kind) { py_imageio_obj_t *stream = MP_OBJ_TO_PTR(self); mp_printf(print, "{\"type\":%s, \"closed\":%s, \"count\":%u, \"offset\":%u, " "\"version\":%u, \"buffer_size\":%u, \"size\":%u}", @@ -112,39 +112,39 @@ STATIC void py_imageio_print(const mp_print_t *print, mp_obj_t self, mp_print_ki #endif } -STATIC mp_obj_t py_imageio_get_type(mp_obj_t self) { +static mp_obj_t py_imageio_get_type(mp_obj_t self) { py_imageio_obj_t *stream = MP_OBJ_TO_PTR(self); return mp_obj_new_int(stream->type); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_get_type_obj, py_imageio_get_type); +static MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_get_type_obj, py_imageio_get_type); -STATIC mp_obj_t py_imageio_is_closed(mp_obj_t self) { +static mp_obj_t py_imageio_is_closed(mp_obj_t self) { py_imageio_obj_t *stream = MP_OBJ_TO_PTR(self); return mp_obj_new_int(stream->closed); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_is_closed_obj, py_imageio_is_closed); +static MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_is_closed_obj, py_imageio_is_closed); -STATIC mp_obj_t py_imageio_count(mp_obj_t self) { +static mp_obj_t py_imageio_count(mp_obj_t self) { py_imageio_obj_t *stream = MP_OBJ_TO_PTR(self); return mp_obj_new_int(stream->count); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_count_obj, py_imageio_count); +static MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_count_obj, py_imageio_count); -STATIC mp_obj_t py_imageio_offset(mp_obj_t self) { +static mp_obj_t py_imageio_offset(mp_obj_t self) { py_imageio_obj_t *stream = MP_OBJ_TO_PTR(self); return mp_obj_new_int(stream->offset); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_offset_obj, py_imageio_offset); +static MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_offset_obj, py_imageio_offset); #if defined(IMLIB_ENABLE_IMAGE_FILE_IO) -STATIC mp_obj_t py_imageio_version(mp_obj_t self) { +static mp_obj_t py_imageio_version(mp_obj_t self) { py_imageio_obj_t *stream = MP_OBJ_TO_PTR(self); return (stream->type == IMAGE_IO_FILE_STREAM) ? mp_obj_new_int(stream->version) : mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_version_obj, py_imageio_version); +static MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_version_obj, py_imageio_version); #endif -STATIC mp_obj_t py_imageio_buffer_size(mp_obj_t self) { +static mp_obj_t py_imageio_buffer_size(mp_obj_t self) { py_imageio_obj_t *stream = MP_OBJ_TO_PTR(self); #if defined(IMLIB_ENABLE_IMAGE_FILE_IO) @@ -155,9 +155,9 @@ STATIC mp_obj_t py_imageio_buffer_size(mp_obj_t self) { return mp_obj_new_int(stream->size - IMAGE_T_SIZE_ALIGNED); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_buffer_size_obj, py_imageio_buffer_size); +static MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_buffer_size_obj, py_imageio_buffer_size); -STATIC mp_obj_t py_imageio_size(mp_obj_t self) { +static mp_obj_t py_imageio_size(mp_obj_t self) { py_imageio_obj_t *stream = MP_OBJ_TO_PTR(self); #if defined(IMLIB_ENABLE_IMAGE_FILE_IO) @@ -168,9 +168,9 @@ STATIC mp_obj_t py_imageio_size(mp_obj_t self) { return mp_obj_new_int(stream->count * stream->size); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_size_obj, py_imageio_size); +static MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_size_obj, py_imageio_size); -STATIC mp_obj_t py_imageio_write(mp_obj_t self, mp_obj_t img_obj) { +static mp_obj_t py_imageio_write(mp_obj_t self, mp_obj_t img_obj) { py_imageio_obj_t *stream = py_imageio_obj(self); image_t *image = py_image_cobj(img_obj); @@ -243,9 +243,9 @@ STATIC mp_obj_t py_imageio_write(mp_obj_t self, mp_obj_t img_obj) { return self; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(py_imageio_write_obj, py_imageio_write); +static MP_DEFINE_CONST_FUN_OBJ_2(py_imageio_write_obj, py_imageio_write); -STATIC void int_py_imageio_pause(py_imageio_obj_t *stream, bool pause) { +static void int_py_imageio_pause(py_imageio_obj_t *stream, bool pause) { uint32_t elapsed_ms; if (0) { @@ -265,7 +265,7 @@ STATIC void int_py_imageio_pause(py_imageio_obj_t *stream, bool pause) { } #if defined(IMLIB_ENABLE_IMAGE_FILE_IO) -STATIC void int_py_imageio_read_chunk(py_imageio_obj_t *stream, image_t *image, bool pause) { +static void int_py_imageio_read_chunk(py_imageio_obj_t *stream, image_t *image, bool pause) { FIL *fp = &stream->fp; if (f_eof(fp)) { @@ -308,7 +308,7 @@ STATIC void int_py_imageio_read_chunk(py_imageio_obj_t *stream, image_t *image, } #endif -STATIC mp_obj_t py_imageio_read(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_imageio_read(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_copy_to_fb, ARG_loop, ARG_pause }; static const mp_arg_t allowed_args[] = { { MP_QSTR_copy_to_fb, MP_ARG_INT, {.u_bool = true } }, @@ -404,9 +404,9 @@ STATIC mp_obj_t py_imageio_read(uint n_args, const mp_obj_t *pos_args, mp_map_t } return py_image_from_struct(&image); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_imageio_read_obj, 1, py_imageio_read); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_imageio_read_obj, 1, py_imageio_read); -STATIC mp_obj_t py_imageio_seek(mp_obj_t self, mp_obj_t offs) { +static mp_obj_t py_imageio_seek(mp_obj_t self, mp_obj_t offs) { py_imageio_obj_t *stream = py_imageio_obj(self); int offset = mp_obj_get_int(offs); @@ -441,9 +441,9 @@ STATIC mp_obj_t py_imageio_seek(mp_obj_t self, mp_obj_t offs) { return self; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(py_imageio_seek_obj, py_imageio_seek); +static MP_DEFINE_CONST_FUN_OBJ_2(py_imageio_seek_obj, py_imageio_seek); -STATIC mp_obj_t py_imageio_sync(mp_obj_t self) { +static mp_obj_t py_imageio_sync(mp_obj_t self) { #if defined(IMLIB_ENABLE_IMAGE_FILE_IO) py_imageio_obj_t *stream = py_imageio_obj(self); @@ -454,9 +454,9 @@ STATIC mp_obj_t py_imageio_sync(mp_obj_t self) { return self; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_sync_obj, py_imageio_sync); +static MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_sync_obj, py_imageio_sync); -STATIC mp_obj_t py_imageio_close(mp_obj_t self) { +static mp_obj_t py_imageio_close(mp_obj_t self) { py_imageio_obj_t *stream = py_imageio_obj(self); if (0) { @@ -472,12 +472,11 @@ STATIC mp_obj_t py_imageio_close(mp_obj_t self) { return self; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_close_obj, py_imageio_close); +static MP_DEFINE_CONST_FUN_OBJ_1(py_imageio_close_obj, py_imageio_close); -STATIC mp_obj_t py_imageio_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { +static mp_obj_t py_imageio_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 2, 2, false); - py_imageio_obj_t *stream = m_new_obj_with_finaliser(py_imageio_obj_t); - stream->base.type = &py_imageio_type; + py_imageio_obj_t *stream = mp_obj_malloc_with_finaliser(py_imageio_obj_t, &py_imageio_type); stream->closed = false; if (0) { @@ -580,7 +579,7 @@ STATIC mp_obj_t py_imageio_make_new(const mp_obj_type_t *type, size_t n_args, si return MP_OBJ_FROM_PTR(stream); } -STATIC const mp_rom_map_elem_t py_imageio_locals_dict_table[] = { +static const mp_rom_map_elem_t py_imageio_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_imageio) }, { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&py_imageio_close_obj) }, { MP_ROM_QSTR(MP_QSTR_FILE_STREAM), MP_ROM_INT(IMAGE_IO_FILE_STREAM) }, @@ -603,7 +602,7 @@ STATIC const mp_rom_map_elem_t py_imageio_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&py_imageio_close_obj) } }; -STATIC MP_DEFINE_CONST_DICT(py_imageio_locals_dict, py_imageio_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_imageio_locals_dict, py_imageio_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( py_imageio_type, diff --git a/src/omv/modules/py_mjpeg.c b/src/omv/modules/py_mjpeg.c index 80376f3e7..46e8a4460 100644 --- a/src/omv/modules/py_mjpeg.c +++ b/src/omv/modules/py_mjpeg.c @@ -38,7 +38,7 @@ typedef struct py_mjpeg_obj { FIL fp; } py_mjpeg_obj_t; -STATIC void py_mjpeg_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +static void py_mjpeg_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { py_mjpeg_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_printf(print, "{\"closed\":%s, \"width\":%u, \"height\":%u, \"count\":%u, \"size\":%u}", self->closed ? "\"true\"" : "\"false\"", @@ -48,37 +48,37 @@ STATIC void py_mjpeg_print(const mp_print_t *print, mp_obj_t self_in, mp_print_k f_size(&self->fp)); } -STATIC mp_obj_t py_mjpeg_is_closed(mp_obj_t self_in) { +static mp_obj_t py_mjpeg_is_closed(mp_obj_t self_in) { py_mjpeg_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->closed); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_mjpeg_is_closed_obj, py_mjpeg_is_closed); +static MP_DEFINE_CONST_FUN_OBJ_1(py_mjpeg_is_closed_obj, py_mjpeg_is_closed); -STATIC mp_obj_t py_mjpeg_width(mp_obj_t self_in) { +static mp_obj_t py_mjpeg_width(mp_obj_t self_in) { py_mjpeg_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->width); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_mjpeg_width_obj, py_mjpeg_width); +static MP_DEFINE_CONST_FUN_OBJ_1(py_mjpeg_width_obj, py_mjpeg_width); -STATIC mp_obj_t py_mjpeg_height(mp_obj_t self_in) { +static mp_obj_t py_mjpeg_height(mp_obj_t self_in) { py_mjpeg_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->height); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_mjpeg_height_obj, py_mjpeg_height); +static MP_DEFINE_CONST_FUN_OBJ_1(py_mjpeg_height_obj, py_mjpeg_height); -STATIC mp_obj_t py_mjpeg_count(mp_obj_t self_in) { +static mp_obj_t py_mjpeg_count(mp_obj_t self_in) { py_mjpeg_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(self->frames); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_mjpeg_count_obj, py_mjpeg_count); +static MP_DEFINE_CONST_FUN_OBJ_1(py_mjpeg_count_obj, py_mjpeg_count); -STATIC mp_obj_t py_mjpeg_size(mp_obj_t self_in) { +static mp_obj_t py_mjpeg_size(mp_obj_t self_in) { py_mjpeg_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(f_size(&self->fp)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_mjpeg_size_obj, py_mjpeg_size); +static MP_DEFINE_CONST_FUN_OBJ_1(py_mjpeg_size_obj, py_mjpeg_size); -STATIC mp_obj_t py_mjpeg_write(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_mjpeg_write(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_roi, ARG_channel, ARG_alpha, ARG_color_palette, ARG_alpha_palette, ARG_hint, ARG_quality }; static const mp_arg_t allowed_args[] = { { MP_QSTR_roi, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_rom_obj = MP_ROM_NONE} }, @@ -139,9 +139,9 @@ STATIC mp_obj_t py_mjpeg_write(uint n_args, const mp_obj_t *pos_args, mp_map_t * return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_mjpeg_write_obj, 2, py_mjpeg_write); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_mjpeg_write_obj, 2, py_mjpeg_write); -STATIC mp_obj_t py_mjpeg_sync(mp_obj_t self_in) { +static mp_obj_t py_mjpeg_sync(mp_obj_t self_in) { py_mjpeg_obj_t *self = MP_OBJ_TO_PTR(self_in); if (self->closed) { mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("MJPEG stream is closed")); @@ -149,9 +149,9 @@ STATIC mp_obj_t py_mjpeg_sync(mp_obj_t self_in) { mjpeg_sync(&self->fp, self->frames, self->bytes, self->us_avg); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_mjpeg_sync_obj, py_mjpeg_sync); +static MP_DEFINE_CONST_FUN_OBJ_1(py_mjpeg_sync_obj, py_mjpeg_sync); -STATIC mp_obj_t py_mjpeg_close(mp_obj_t self_in) { +static mp_obj_t py_mjpeg_close(mp_obj_t self_in) { py_mjpeg_obj_t *self = MP_OBJ_TO_PTR(self_in); if (!self->closed) { mjpeg_close(&self->fp, self->frames, self->bytes, self->us_avg); @@ -159,9 +159,9 @@ STATIC mp_obj_t py_mjpeg_close(mp_obj_t self_in) { self->closed = true; return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_mjpeg_close_obj, py_mjpeg_close); +static MP_DEFINE_CONST_FUN_OBJ_1(py_mjpeg_close_obj, py_mjpeg_close); -STATIC mp_obj_t py_mjpeg_open(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_mjpeg_open(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_width, ARG_height }; static const mp_arg_t allowed_args[] = { { MP_QSTR_width, MP_ARG_INT, {.u_int = -1 } }, @@ -173,9 +173,12 @@ STATIC mp_obj_t py_mjpeg_open(uint n_args, const mp_obj_t *pos_args, mp_map_t *k mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - py_mjpeg_obj_t *mjpeg = m_new_obj_with_finaliser(py_mjpeg_obj_t); - memset(mjpeg, 0, sizeof(py_mjpeg_obj_t)); - mjpeg->base.type = &py_mjpeg_type; + py_mjpeg_obj_t *mjpeg = mp_obj_malloc_with_finaliser(py_mjpeg_obj_t, &py_mjpeg_type); + mjpeg->frames = 0; + mjpeg->bytes = 0; + mjpeg->us_old = 0; + mjpeg->us_avg = 0; + mjpeg->closed = 0; mjpeg->width = (args[ARG_width].u_int == -1) ? framebuffer_get_width() : args[ARG_width].u_int; mjpeg->height = (args[ARG_height].u_int == -1) ? framebuffer_get_height() : args[ARG_height].u_int; @@ -183,9 +186,9 @@ STATIC mp_obj_t py_mjpeg_open(uint n_args, const mp_obj_t *pos_args, mp_map_t *k mjpeg_open(&mjpeg->fp, mjpeg->width, mjpeg->height); return mjpeg; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_mjpeg_open_obj, 1, py_mjpeg_open); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_mjpeg_open_obj, 1, py_mjpeg_open); -STATIC const mp_rom_map_elem_t py_mjpeg_locals_dict_table[] = { +static const mp_rom_map_elem_t py_mjpeg_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_Mjpeg) }, { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&py_mjpeg_close_obj) }, { MP_ROM_QSTR(MP_QSTR_is_closed), MP_ROM_PTR(&py_mjpeg_is_closed_obj) }, @@ -199,9 +202,9 @@ STATIC const mp_rom_map_elem_t py_mjpeg_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&py_mjpeg_close_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(py_mjpeg_locals_dict, py_mjpeg_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_mjpeg_locals_dict, py_mjpeg_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_mjpeg_type, MP_QSTR_Mjpeg, MP_TYPE_FLAG_NONE, @@ -209,12 +212,12 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE( locals_dict, &py_mjpeg_locals_dict ); -STATIC const mp_rom_map_elem_t globals_dict_table[] = { +static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_mjpeg) }, { MP_ROM_QSTR(MP_QSTR_Mjpeg), MP_ROM_PTR(&py_mjpeg_open_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t mjpeg_module = { .base = { &mp_type_module }, diff --git a/src/omv/modules/py_ml.c b/src/omv/modules/py_ml.c index 6b619a213..c0bf49c81 100644 --- a/src/omv/modules/py_ml.c +++ b/src/omv/modules/py_ml.c @@ -28,7 +28,7 @@ #define PY_ML_GRAYSCALE_RANGE ((COLOR_GRAYSCALE_MAX) -(COLOR_GRAYSCALE_MIN)) #define PY_ML_GRAYSCALE_MID (((PY_ML_GRAYSCALE_RANGE) +1) / 2) -STATIC const char *py_ml_map_dtype(py_ml_dtype_t dtype) { +static const char *py_ml_map_dtype(py_ml_dtype_t dtype) { if (dtype == PY_ML_DTYPE_UINT8) { return "uint8"; } else if (dtype == PY_ML_DTYPE_INT8) { @@ -73,7 +73,7 @@ static void py_ml_tuple_hwc(mp_obj_tuple_t *o, size_t *h, size_t *w, size_t *c) *c = mp_obj_get_int(o->items[3]); } -STATIC void py_ml_input_callback(py_ml_model_obj_t *model, void *arg) { +static void py_ml_input_callback(py_ml_model_obj_t *model, void *arg) { // TODO we assume that there's a single input. void *model_input = ml_backend_get_input(model, 0); py_ml_input_data_t *input_data = (py_ml_input_data_t *) arg; @@ -192,7 +192,7 @@ STATIC void py_ml_input_callback(py_ml_model_obj_t *model, void *arg) { } } -STATIC void py_ml_input_callback_regression(py_ml_model_obj_t *model, void *arg) { +static void py_ml_input_callback_regression(py_ml_model_obj_t *model, void *arg) { // TODO we assume that there's a single input. void *model_input = ml_backend_get_input(model, 0); py_ml_input_data_t *input_data = (py_ml_input_data_t *) arg; @@ -236,7 +236,7 @@ STATIC void py_ml_input_callback_regression(py_ml_model_obj_t *model, void *arg) } } -STATIC void py_ml_output_callback(py_ml_model_obj_t *model, void *arg) { +static void py_ml_output_callback(py_ml_model_obj_t *model, void *arg) { mp_obj_list_t *output_list = MP_OBJ_TO_PTR(mp_obj_new_list(model->outputs_size, NULL)); for (size_t i = 0; i < model->outputs_size; i++) { void *model_output = ml_backend_get_output(model, i); @@ -271,7 +271,7 @@ STATIC void py_ml_output_callback(py_ml_model_obj_t *model, void *arg) { // TF Model Object. static const mp_obj_type_t py_ml_model_type; -STATIC void py_ml_model_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +static void py_ml_model_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { py_ml_model_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_printf(print, "{size: %d, ram: %d, inputs_size: %d, input_dtype: %s, input_scale: %f, input_zero_point: %d, " @@ -281,7 +281,7 @@ STATIC void py_ml_model_print(const mp_print_t *print, mp_obj_t self_in, mp_prin (double) self->output_scale, self->output_zero_point); } -STATIC mp_obj_t py_ml_model_predict(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_ml_model_predict(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_roi, ARG_callback, ARG_scale, ARG_mean, ARG_stdev }; static const mp_arg_t allowed_args[] = { { MP_QSTR_roi, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_rom_obj = MP_ROM_NONE} }, @@ -336,9 +336,9 @@ STATIC mp_obj_t py_ml_model_predict(uint n_args, const mp_obj_t *pos_args, mp_ma return output_data; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_ml_model_predict_obj, 2, py_ml_model_predict); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_ml_model_predict_obj, 2, py_ml_model_predict); -STATIC void py_ml_model_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { +static void py_ml_model_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { py_ml_model_obj_t *self = MP_OBJ_TO_PTR(self_in); const char *str; if (dest[0] == MP_OBJ_NULL) { @@ -399,8 +399,7 @@ mp_obj_t py_ml_model_make_new(const mp_obj_type_t *type, size_t n_args, size_t n const char *path = mp_obj_str_get_str(args[ARG_path].u_obj); - py_ml_model_obj_t *model = m_new_obj_with_finaliser(py_ml_model_obj_t); - model->base.type = &py_ml_model_type; + py_ml_model_obj_t *model = mp_obj_malloc_with_finaliser(py_ml_model_obj_t, &py_ml_model_type); model->data = NULL; model->fb_alloc = args[ARG_load_to_fb].u_int; mp_obj_list_t *labels = NULL; @@ -459,23 +458,23 @@ mp_obj_t py_ml_model_make_new(const mp_obj_type_t *type, size_t n_args, size_t n } } -STATIC mp_obj_t py_ml_model_deinit(mp_obj_t self_in) { +static mp_obj_t py_ml_model_deinit(mp_obj_t self_in) { py_ml_model_obj_t *model = MP_OBJ_TO_PTR(self_in); if (model->fb_alloc) { fb_alloc_free_till_mark_past_mark_permanent(); } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_ml_model_deinit_obj, py_ml_model_deinit); +static MP_DEFINE_CONST_FUN_OBJ_1(py_ml_model_deinit_obj, py_ml_model_deinit); -STATIC const mp_rom_map_elem_t py_ml_model_locals_dict_table[] = { +static const mp_rom_map_elem_t py_ml_model_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&py_ml_model_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR_predict), MP_ROM_PTR(&py_ml_model_predict_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(py_ml_model_locals_dict, py_ml_model_locals_dict_table); +static MP_DEFINE_CONST_DICT(py_ml_model_locals_dict, py_ml_model_locals_dict_table); -STATIC MP_DEFINE_CONST_OBJ_TYPE( +static MP_DEFINE_CONST_OBJ_TYPE( py_ml_model_type, MP_QSTR_ml_model, MP_TYPE_FLAG_NONE, @@ -487,7 +486,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE( extern const mp_obj_type_t py_ml_nms_type; -STATIC const mp_rom_map_elem_t py_ml_globals_dict_table[] = { +static const mp_rom_map_elem_t py_ml_globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_ml) }, { MP_ROM_QSTR(MP_QSTR_Model), MP_ROM_PTR(&py_ml_model_type) }, { MP_ROM_QSTR(MP_QSTR_NMS), MP_ROM_PTR(&py_ml_nms_type) }, @@ -497,7 +496,7 @@ STATIC const mp_rom_map_elem_t py_ml_globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SCALE_S128_127), MP_ROM_INT(PY_ML_SCALE_S128_127) }, }; -STATIC MP_DEFINE_CONST_DICT(py_ml_globals_dict, py_ml_globals_dict_table); +static MP_DEFINE_CONST_DICT(py_ml_globals_dict, py_ml_globals_dict_table); const mp_obj_module_t ml_module = { .base = { &mp_type_module }, diff --git a/src/omv/modules/py_ml_nms.c b/src/omv/modules/py_ml_nms.c index 0ace7ce49..b71b1a8f0 100644 --- a/src/omv/modules/py_ml_nms.c +++ b/src/omv/modules/py_ml_nms.c @@ -26,7 +26,7 @@ typedef struct py_ml_nms_obj { const mp_obj_type_t py_ml_nms_type; // The use of mp_arg_parse_all() is deliberately avoided here to ensure this method remains fast. -STATIC mp_obj_t py_ml_nms_add_bounding_box(uint n_args, const mp_obj_t *pos_args) { +static mp_obj_t py_ml_nms_add_bounding_box(uint n_args, const mp_obj_t *pos_args) { enum { ARG_self, ARG_xmin, ARG_ymin, ARG_xmax, ARG_ymax, ARG_score, ARG_label_index }; py_ml_nms_obj_t *self_in = MP_OBJ_TO_PTR(pos_args[ARG_self]); @@ -52,9 +52,9 @@ STATIC mp_obj_t py_ml_nms_add_bounding_box(uint n_args, const mp_obj_t *pos_args return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_ml_nms_add_bounding_box_obj, 7, 7, py_ml_nms_add_bounding_box); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_ml_nms_add_bounding_box_obj, 7, 7, py_ml_nms_add_bounding_box); -STATIC mp_obj_t py_ml_nms_get_bounding_boxes(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_ml_nms_get_bounding_boxes(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_threshold, ARG_sigma }; static const mp_arg_t allowed_args[] = { { MP_QSTR_threshold, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_rom_obj = MP_ROM_NONE } }, @@ -88,7 +88,7 @@ STATIC mp_obj_t py_ml_nms_get_bounding_boxes(uint n_args, const mp_obj_t *pos_ar return list; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_ml_nms_get_bounding_boxes_obj, 1, py_ml_nms_get_bounding_boxes); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_ml_nms_get_bounding_boxes_obj, 1, py_ml_nms_get_bounding_boxes); mp_obj_t py_ml_nms_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_window_w, ARG_window_h, ARG_roi }; @@ -125,12 +125,12 @@ mp_obj_t py_ml_nms_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_k return MP_OBJ_FROM_PTR(model); } -STATIC const mp_rom_map_elem_t py_ml_nms_locals_table[] = { +static const mp_rom_map_elem_t py_ml_nms_locals_table[] = { { MP_ROM_QSTR(MP_QSTR_add_bounding_box), MP_ROM_PTR(&py_ml_nms_add_bounding_box_obj) }, { MP_ROM_QSTR(MP_QSTR_get_bounding_boxes), MP_ROM_PTR(&py_ml_nms_get_bounding_boxes_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(py_ml_nms_locals_dict, py_ml_nms_locals_table); +static MP_DEFINE_CONST_DICT(py_ml_nms_locals_dict, py_ml_nms_locals_table); MP_DEFINE_CONST_OBJ_TYPE( py_ml_nms_type, diff --git a/src/omv/modules/py_omv.c b/src/omv/modules/py_omv.c index 02e4235a4..494c16153 100644 --- a/src/omv/modules/py_omv.c +++ b/src/omv/modules/py_omv.c @@ -24,19 +24,19 @@ static mp_obj_t py_omv_version_string() { FIRMWARE_VERSION_PATCH); return mp_obj_new_str(str, strlen(str)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_omv_version_string_obj, py_omv_version_string); +static MP_DEFINE_CONST_FUN_OBJ_0(py_omv_version_string_obj, py_omv_version_string); static mp_obj_t py_omv_arch() { char *str = OMV_BOARD_ARCH; return mp_obj_new_str(str, strlen(str)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_omv_arch_obj, py_omv_arch); +static MP_DEFINE_CONST_FUN_OBJ_0(py_omv_arch_obj, py_omv_arch); static mp_obj_t py_omv_board_type() { char *str = OMV_BOARD_TYPE; return mp_obj_new_str(str, strlen(str)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_omv_board_type_obj, py_omv_board_type); +static MP_DEFINE_CONST_FUN_OBJ_0(py_omv_board_type_obj, py_omv_board_type); static mp_obj_t py_omv_board_id() { char str[25]; @@ -46,7 +46,7 @@ static mp_obj_t py_omv_board_id() { *((unsigned int *) (OMV_BOARD_UID_ADDR + 0))); return mp_obj_new_str(str, strlen(str)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_omv_board_id_obj, py_omv_board_id); +static MP_DEFINE_CONST_FUN_OBJ_0(py_omv_board_id_obj, py_omv_board_id); static mp_obj_t py_omv_disable_fb(uint n_args, const mp_obj_t *args) { if (!n_args) { @@ -55,7 +55,7 @@ static mp_obj_t py_omv_disable_fb(uint n_args, const mp_obj_t *args) { fb_set_streaming_enabled(!mp_obj_get_int(args[0])); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_omv_disable_fb_obj, 0, 1, py_omv_disable_fb); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_omv_disable_fb_obj, 0, 1, py_omv_disable_fb); static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_omv) }, @@ -69,7 +69,7 @@ static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_disable_fb), MP_ROM_PTR(&py_omv_disable_fb_obj) } }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t omv_module = { .base = { &mp_type_module }, diff --git a/src/omv/modules/py_sensor.c b/src/omv/modules/py_sensor.c index 7f5cf8507..ae953f121 100644 --- a/src/omv/modules/py_sensor.c +++ b/src/omv/modules/py_sensor.c @@ -78,7 +78,7 @@ static mp_obj_t py_sensor__init__() { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor__init__obj, py_sensor__init__); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor__init__obj, py_sensor__init__); static mp_obj_t py_sensor_reset() { int error = sensor_reset(); @@ -94,25 +94,25 @@ static mp_obj_t py_sensor_reset() { #endif // MICROPY_PY_IMU return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_reset_obj, py_sensor_reset); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_reset_obj, py_sensor_reset); static mp_obj_t py_sensor_sleep(mp_obj_t enable) { PY_ASSERT_FALSE_MSG(sensor_sleep(mp_obj_is_true(enable)) != 0, "Sleep Failed"); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_sleep_obj, py_sensor_sleep); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_sleep_obj, py_sensor_sleep); static mp_obj_t py_sensor_shutdown(mp_obj_t enable) { PY_ASSERT_FALSE_MSG(sensor_shutdown(mp_obj_is_true(enable)) != 0, "Shutdown Failed"); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_shutdown_obj, py_sensor_shutdown); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_shutdown_obj, py_sensor_shutdown); static mp_obj_t py_sensor_flush() { framebuffer_update_jpeg_buffer(); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_flush_obj, py_sensor_flush); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_flush_obj, py_sensor_flush); static mp_obj_t py_sensor_snapshot(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { #if MICROPY_PY_IMU @@ -130,7 +130,7 @@ static mp_obj_t py_sensor_snapshot(uint n_args, const mp_obj_t *args, mp_map_t * } return image; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_snapshot_obj, 0, py_sensor_snapshot); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_snapshot_obj, 0, py_sensor_snapshot); static mp_obj_t py_sensor_skip_frames(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { mp_map_elem_t *kw_arg = mp_map_lookup(kw_args, MP_ROM_QSTR(MP_QSTR_time), MP_MAP_LOOKUP); @@ -159,17 +159,17 @@ static mp_obj_t py_sensor_skip_frames(uint n_args, const mp_obj_t *args, mp_map_ return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_skip_frames_obj, 0, py_sensor_skip_frames); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_skip_frames_obj, 0, py_sensor_skip_frames); static mp_obj_t py_sensor_width() { return mp_obj_new_int(resolution[sensor.framesize][0]); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_width_obj, py_sensor_width); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_width_obj, py_sensor_width); static mp_obj_t py_sensor_height() { return mp_obj_new_int(resolution[sensor.framesize][1]); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_height_obj, py_sensor_height); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_height_obj, py_sensor_height); static mp_obj_t py_sensor_get_fb() { if (framebuffer_get_depth() < 0) { @@ -180,17 +180,17 @@ static mp_obj_t py_sensor_get_fb() { framebuffer_init_image(&image); return py_image_from_struct(&image); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_fb_obj, py_sensor_get_fb); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_fb_obj, py_sensor_get_fb); static mp_obj_t py_sensor_get_id() { return mp_obj_new_int(sensor_get_id()); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_id_obj, py_sensor_get_id); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_id_obj, py_sensor_get_id); static mp_obj_t py_sensor_get_frame_available() { return mp_obj_new_bool(framebuffer->tail != framebuffer->head); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_frame_available_obj, py_sensor_get_frame_available); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_frame_available_obj, py_sensor_get_frame_available); static mp_obj_t py_sensor_alloc_extra_fb(mp_obj_t w_obj, mp_obj_t h_obj, mp_obj_t pixfmt_obj) { int w = mp_obj_get_int(w_obj); @@ -212,13 +212,13 @@ static mp_obj_t py_sensor_alloc_extra_fb(mp_obj_t w_obj, mp_obj_t h_obj, mp_obj_ fb_alloc_mark_permanent(); // pixels will not be popped on exception return r; } -STATIC MP_DEFINE_CONST_FUN_OBJ_3(py_sensor_alloc_extra_fb_obj, py_sensor_alloc_extra_fb); +static MP_DEFINE_CONST_FUN_OBJ_3(py_sensor_alloc_extra_fb_obj, py_sensor_alloc_extra_fb); static mp_obj_t py_sensor_dealloc_extra_fb() { fb_alloc_free_till_mark_past_mark_permanent(); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_dealloc_extra_fb_obj, py_sensor_dealloc_extra_fb); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_dealloc_extra_fb_obj, py_sensor_dealloc_extra_fb); static mp_obj_t py_sensor_set_pixformat(mp_obj_t pixformat) { int error = sensor_set_pixformat(mp_obj_get_int(pixformat)); @@ -227,7 +227,7 @@ static mp_obj_t py_sensor_set_pixformat(mp_obj_t pixformat) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_pixformat_obj, py_sensor_set_pixformat); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_pixformat_obj, py_sensor_set_pixformat); static mp_obj_t py_sensor_get_pixformat() { if (sensor.pixformat == PIXFORMAT_INVALID) { @@ -235,7 +235,7 @@ static mp_obj_t py_sensor_get_pixformat() { } return mp_obj_new_int(sensor.pixformat); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_pixformat_obj, py_sensor_get_pixformat); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_pixformat_obj, py_sensor_get_pixformat); static mp_obj_t py_sensor_set_framesize(mp_obj_t framesize) { int error = sensor_set_framesize(mp_obj_get_int(framesize)); @@ -244,7 +244,7 @@ static mp_obj_t py_sensor_set_framesize(mp_obj_t framesize) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_framesize_obj, py_sensor_set_framesize); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_framesize_obj, py_sensor_set_framesize); static mp_obj_t py_sensor_get_framesize() { if (sensor.framesize == FRAMESIZE_INVALID) { @@ -252,7 +252,7 @@ static mp_obj_t py_sensor_get_framesize() { } return mp_obj_new_int(sensor.framesize); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_framesize_obj, py_sensor_get_framesize); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_framesize_obj, py_sensor_get_framesize); static mp_obj_t py_sensor_set_framerate(mp_obj_t framerate) { int error = sensor_set_framerate(mp_obj_get_int(framerate)); @@ -261,7 +261,7 @@ static mp_obj_t py_sensor_set_framerate(mp_obj_t framerate) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_framerate_obj, py_sensor_set_framerate); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_framerate_obj, py_sensor_set_framerate); static mp_obj_t py_sensor_get_framerate() { if (sensor.framerate == 0) { @@ -269,7 +269,7 @@ static mp_obj_t py_sensor_get_framerate() { } return mp_obj_new_int(sensor.framerate); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_framerate_obj, py_sensor_get_framerate); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_framerate_obj, py_sensor_get_framerate); static mp_obj_t py_sensor_set_windowing(uint n_args, const mp_obj_t *args) { if (sensor.framesize == FRAMESIZE_INVALID) { @@ -322,7 +322,7 @@ static mp_obj_t py_sensor_set_windowing(uint n_args, const mp_obj_t *args) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_sensor_set_windowing_obj, 1, 4, py_sensor_set_windowing); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_sensor_set_windowing_obj, 1, 4, py_sensor_set_windowing); static mp_obj_t py_sensor_get_windowing() { if (sensor.framesize == FRAMESIZE_INVALID) { @@ -334,7 +334,7 @@ static mp_obj_t py_sensor_get_windowing() { mp_obj_new_int(framebuffer_get_u()), mp_obj_new_int(framebuffer_get_v())}); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_windowing_obj, py_sensor_get_windowing); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_windowing_obj, py_sensor_get_windowing); static mp_obj_t py_sensor_set_gainceiling(mp_obj_t gainceiling) { gainceiling_t gain; @@ -370,7 +370,7 @@ static mp_obj_t py_sensor_set_gainceiling(mp_obj_t gainceiling) { } return mp_const_true; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_gainceiling_obj, py_sensor_set_gainceiling); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_gainceiling_obj, py_sensor_set_gainceiling); static mp_obj_t py_sensor_set_brightness(mp_obj_t brightness) { if (sensor_set_brightness(mp_obj_get_int(brightness)) != 0) { @@ -378,7 +378,7 @@ static mp_obj_t py_sensor_set_brightness(mp_obj_t brightness) { } return mp_const_true; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_brightness_obj, py_sensor_set_brightness); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_brightness_obj, py_sensor_set_brightness); static mp_obj_t py_sensor_set_contrast(mp_obj_t contrast) { if (sensor_set_contrast(mp_obj_get_int(contrast)) != 0) { @@ -386,7 +386,7 @@ static mp_obj_t py_sensor_set_contrast(mp_obj_t contrast) { } return mp_const_true; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_contrast_obj, py_sensor_set_contrast); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_contrast_obj, py_sensor_set_contrast); static mp_obj_t py_sensor_set_saturation(mp_obj_t saturation) { if (sensor_set_saturation(mp_obj_get_int(saturation)) != 0) { @@ -394,7 +394,7 @@ static mp_obj_t py_sensor_set_saturation(mp_obj_t saturation) { } return mp_const_true; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_saturation_obj, py_sensor_set_saturation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_saturation_obj, py_sensor_set_saturation); static mp_obj_t py_sensor_set_quality(mp_obj_t qs) { int q = mp_obj_get_int(qs); @@ -407,7 +407,7 @@ static mp_obj_t py_sensor_set_quality(mp_obj_t qs) { } return mp_const_true; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_quality_obj, py_sensor_set_quality); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_quality_obj, py_sensor_set_quality); static mp_obj_t py_sensor_set_colorbar(mp_obj_t enable) { if (sensor_set_colorbar(mp_obj_is_true(enable)) != 0) { @@ -415,7 +415,7 @@ static mp_obj_t py_sensor_set_colorbar(mp_obj_t enable) { } return mp_const_true; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_colorbar_obj, py_sensor_set_colorbar); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_colorbar_obj, py_sensor_set_colorbar); static mp_obj_t py_sensor_set_auto_gain(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_gain_db, ARG_gain_db_ceiling }; @@ -441,7 +441,7 @@ static mp_obj_t py_sensor_set_auto_gain(uint n_args, const mp_obj_t *pos_args, m } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_set_auto_gain_obj, 1, py_sensor_set_auto_gain); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_set_auto_gain_obj, 1, py_sensor_set_auto_gain); static mp_obj_t py_sensor_get_gain_db() { float gain_db; @@ -451,7 +451,7 @@ static mp_obj_t py_sensor_get_gain_db() { } return mp_obj_new_float(gain_db); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_gain_db_obj, py_sensor_get_gain_db); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_gain_db_obj, py_sensor_get_gain_db); static mp_obj_t py_sensor_set_auto_exposure(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_exposure_us }; @@ -473,7 +473,7 @@ static mp_obj_t py_sensor_set_auto_exposure(uint n_args, const mp_obj_t *pos_arg } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_set_auto_exposure_obj, 1, py_sensor_set_auto_exposure); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_set_auto_exposure_obj, 1, py_sensor_set_auto_exposure); static mp_obj_t py_sensor_get_exposure_us() { int exposure_us; @@ -483,7 +483,7 @@ static mp_obj_t py_sensor_get_exposure_us() { } return mp_obj_new_int(exposure_us); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_exposure_us_obj, py_sensor_get_exposure_us); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_exposure_us_obj, py_sensor_get_exposure_us); static mp_obj_t py_sensor_set_auto_whitebal(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_rgb_gain_db }; @@ -508,7 +508,7 @@ static mp_obj_t py_sensor_set_auto_whitebal(uint n_args, const mp_obj_t *pos_arg } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_set_auto_whitebal_obj, 1, py_sensor_set_auto_whitebal); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_set_auto_whitebal_obj, 1, py_sensor_set_auto_whitebal); static mp_obj_t py_sensor_get_rgb_gain_db() { float r_gain_db = 0.0, g_gain_db = 0.0, b_gain_db = 0.0; @@ -522,7 +522,7 @@ static mp_obj_t py_sensor_get_rgb_gain_db() { mp_obj_new_float(b_gain_db) }); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_rgb_gain_db_obj, py_sensor_get_rgb_gain_db); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_rgb_gain_db_obj, py_sensor_get_rgb_gain_db); static mp_obj_t py_sensor_set_auto_blc(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_enable, ARG_regs }; @@ -554,7 +554,7 @@ static mp_obj_t py_sensor_set_auto_blc(uint n_args, const mp_obj_t *pos_args, mp } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_set_auto_blc_obj, 1, py_sensor_set_auto_blc); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_set_auto_blc_obj, 1, py_sensor_set_auto_blc); static mp_obj_t py_sensor_get_blc_regs() { int regs[sensor.hw_flags.blc_size]; @@ -569,7 +569,7 @@ static mp_obj_t py_sensor_get_blc_regs() { } return l; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_blc_regs_obj, py_sensor_get_blc_regs); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_blc_regs_obj, py_sensor_get_blc_regs); static mp_obj_t py_sensor_set_hmirror(mp_obj_t enable) { int error = sensor_set_hmirror(mp_obj_is_true(enable)); @@ -578,12 +578,12 @@ static mp_obj_t py_sensor_set_hmirror(mp_obj_t enable) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_hmirror_obj, py_sensor_set_hmirror); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_hmirror_obj, py_sensor_set_hmirror); static mp_obj_t py_sensor_get_hmirror() { return mp_obj_new_bool(sensor_get_hmirror()); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_hmirror_obj, py_sensor_get_hmirror); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_hmirror_obj, py_sensor_get_hmirror); static mp_obj_t py_sensor_set_vflip(mp_obj_t enable) { int error = sensor_set_vflip(mp_obj_is_true(enable)); @@ -592,12 +592,12 @@ static mp_obj_t py_sensor_set_vflip(mp_obj_t enable) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_vflip_obj, py_sensor_set_vflip); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_vflip_obj, py_sensor_set_vflip); static mp_obj_t py_sensor_get_vflip() { return mp_obj_new_bool(sensor_get_vflip()); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_vflip_obj, py_sensor_get_vflip); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_vflip_obj, py_sensor_get_vflip); static mp_obj_t py_sensor_set_transpose(mp_obj_t enable) { int error = sensor_set_transpose(mp_obj_is_true(enable)); @@ -606,12 +606,12 @@ static mp_obj_t py_sensor_set_transpose(mp_obj_t enable) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_transpose_obj, py_sensor_set_transpose); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_transpose_obj, py_sensor_set_transpose); static mp_obj_t py_sensor_get_transpose() { return mp_obj_new_bool(sensor_get_transpose()); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_transpose_obj, py_sensor_get_transpose); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_transpose_obj, py_sensor_get_transpose); static mp_obj_t py_sensor_set_auto_rotation(mp_obj_t enable) { int error = sensor_set_auto_rotation(mp_obj_is_true(enable)); @@ -620,12 +620,12 @@ static mp_obj_t py_sensor_set_auto_rotation(mp_obj_t enable) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_auto_rotation_obj, py_sensor_set_auto_rotation); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_auto_rotation_obj, py_sensor_set_auto_rotation); static mp_obj_t py_sensor_get_auto_rotation() { return mp_obj_new_bool(sensor_get_auto_rotation()); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_auto_rotation_obj, py_sensor_get_auto_rotation); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_auto_rotation_obj, py_sensor_get_auto_rotation); static mp_obj_t py_sensor_set_framebuffers(mp_obj_t count) { mp_int_t c = mp_obj_get_int(count); @@ -645,12 +645,12 @@ static mp_obj_t py_sensor_set_framebuffers(mp_obj_t count) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_framebuffers_obj, py_sensor_set_framebuffers); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_framebuffers_obj, py_sensor_set_framebuffers); static mp_obj_t py_sensor_get_framebuffers() { return mp_obj_new_int(framebuffer->n_buffers); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_framebuffers_obj, py_sensor_get_framebuffers); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_framebuffers_obj, py_sensor_get_framebuffers); static mp_obj_t py_sensor_disable_delays(uint n_args, const mp_obj_t *args) { if (!n_args) { @@ -660,7 +660,7 @@ static mp_obj_t py_sensor_disable_delays(uint n_args, const mp_obj_t *args) { sensor.disable_delays = mp_obj_get_int(args[0]); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_sensor_disable_delays_obj, 0, 1, py_sensor_disable_delays); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_sensor_disable_delays_obj, 0, 1, py_sensor_disable_delays); static mp_obj_t py_sensor_disable_full_flush(uint n_args, const mp_obj_t *args) { if (!n_args) { @@ -670,7 +670,7 @@ static mp_obj_t py_sensor_disable_full_flush(uint n_args, const mp_obj_t *args) sensor.disable_full_flush = mp_obj_get_int(args[0]); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_sensor_disable_full_flush_obj, 0, 1, py_sensor_disable_full_flush); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_sensor_disable_full_flush_obj, 0, 1, py_sensor_disable_full_flush); static mp_obj_t py_sensor_set_special_effect(mp_obj_t sde) { if (sensor_set_special_effect(mp_obj_get_int(sde)) != 0) { @@ -678,7 +678,7 @@ static mp_obj_t py_sensor_set_special_effect(mp_obj_t sde) { } return mp_const_true; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_special_effect_obj, py_sensor_set_special_effect); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_special_effect_obj, py_sensor_set_special_effect); static mp_obj_t py_sensor_set_lens_correction(mp_obj_t enable, mp_obj_t radi, mp_obj_t coef) { if (sensor_set_lens_correction(mp_obj_is_true(enable), @@ -687,7 +687,7 @@ static mp_obj_t py_sensor_set_lens_correction(mp_obj_t enable, mp_obj_t radi, mp } return mp_const_true; } -STATIC MP_DEFINE_CONST_FUN_OBJ_3(py_sensor_set_lens_correction_obj, py_sensor_set_lens_correction); +static MP_DEFINE_CONST_FUN_OBJ_3(py_sensor_set_lens_correction_obj, py_sensor_set_lens_correction); static void sensor_vsync_callback(uint32_t vsync) { if (mp_obj_is_callable(vsync_callback)) { @@ -706,7 +706,7 @@ static mp_obj_t py_sensor_set_vsync_callback(mp_obj_t vsync_callback_obj) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_vsync_callback_obj, py_sensor_set_vsync_callback); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_vsync_callback_obj, py_sensor_set_vsync_callback); static void sensor_frame_callback() { if (mp_obj_is_callable(frame_callback)) { @@ -725,7 +725,7 @@ static mp_obj_t py_sensor_set_frame_callback(mp_obj_t frame_callback_obj) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_frame_callback_obj, py_sensor_set_frame_callback); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_frame_callback_obj, py_sensor_set_frame_callback); static mp_obj_t py_sensor_ioctl(uint n_args, const mp_obj_t *args) { mp_obj_t ret_obj = mp_const_none; @@ -993,7 +993,7 @@ static mp_obj_t py_sensor_ioctl(uint n_args, const mp_obj_t *args) { return ret_obj; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_sensor_ioctl_obj, 1, 5, py_sensor_ioctl); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_sensor_ioctl_obj, 1, 5, py_sensor_ioctl); static mp_obj_t py_sensor_set_color_palette(mp_obj_t palette_obj) { int palette = mp_obj_get_int(palette_obj); @@ -1010,7 +1010,7 @@ static mp_obj_t py_sensor_set_color_palette(mp_obj_t palette_obj) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_color_palette_obj, py_sensor_set_color_palette); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_set_color_palette_obj, py_sensor_set_color_palette); static mp_obj_t py_sensor_get_color_palette() { const uint16_t *palette = sensor_get_color_palette(); @@ -1021,20 +1021,20 @@ static mp_obj_t py_sensor_get_color_palette() { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_color_palette_obj, py_sensor_get_color_palette); +static MP_DEFINE_CONST_FUN_OBJ_0(py_sensor_get_color_palette_obj, py_sensor_get_color_palette); static mp_obj_t py_sensor_write_reg(mp_obj_t addr, mp_obj_t val) { sensor_write_reg(mp_obj_get_int(addr), mp_obj_get_int(val)); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(py_sensor_write_reg_obj, py_sensor_write_reg); +static MP_DEFINE_CONST_FUN_OBJ_2(py_sensor_write_reg_obj, py_sensor_write_reg); static mp_obj_t py_sensor_read_reg(mp_obj_t addr) { return mp_obj_new_int(sensor_read_reg(mp_obj_get_int(addr))); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_read_reg_obj, py_sensor_read_reg); +static MP_DEFINE_CONST_FUN_OBJ_1(py_sensor_read_reg_obj, py_sensor_read_reg); -STATIC const mp_rom_map_elem_t globals_dict_table[] = { +static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sensor)}, // Pixel Formats @@ -1213,7 +1213,7 @@ STATIC const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___write_reg), MP_ROM_PTR(&py_sensor_write_reg_obj) }, { MP_ROM_QSTR(MP_QSTR___read_reg), MP_ROM_PTR(&py_sensor_read_reg_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t sensor_module = { .base = { &mp_type_module }, diff --git a/src/omv/modules/py_spi_display.c b/src/omv/modules/py_spi_display.c index 6d45319cf..3646d5db6 100644 --- a/src/omv/modules/py_spi_display.c +++ b/src/omv/modules/py_spi_display.c @@ -342,8 +342,7 @@ mp_obj_t spi_display_make_new(const mp_obj_type_t *type, size_t n_args, size_t n mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("Invalid Refresh Rate!")); } - py_display_obj_t *self = m_new_obj_with_finaliser(py_display_obj_t); - self->base.type = &py_spi_display_type; + py_display_obj_t *self = mp_obj_malloc_with_finaliser(py_display_obj_t, &py_spi_display_type); self->framebuffer_tail = 0; self->framebuffer_head = 0; self->width = args[ARG_width].u_int; @@ -407,7 +406,7 @@ mp_obj_t spi_display_make_new(const mp_obj_type_t *type, size_t n_args, size_t n return MP_OBJ_FROM_PTR(self); } -STATIC const py_display_p_t py_display_p = { +static const py_display_p_t py_display_p = { .deinit = spi_display_deinit, .clear = spi_display_clear, .write = spi_display_write, diff --git a/src/omv/modules/py_tfp410.c b/src/omv/modules/py_tfp410.c index 47393ea1f..b55ba797e 100644 --- a/src/omv/modules/py_tfp410.c +++ b/src/omv/modules/py_tfp410.c @@ -63,7 +63,7 @@ static void dvi_extint_callback(mp_obj_t self_in) { } } -STATIC mp_obj_t py_dvi_is_connected(mp_obj_t self_in) { +static mp_obj_t py_dvi_is_connected(mp_obj_t self_in) { py_tfp410_obj_t *self = MP_OBJ_TO_PTR(self_in); bool connected; @@ -72,9 +72,9 @@ STATIC mp_obj_t py_dvi_is_connected(mp_obj_t self_in) { } mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Display init failed!")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_dvi_is_connected_obj, py_dvi_is_connected); +static MP_DEFINE_CONST_FUN_OBJ_1(py_dvi_is_connected_obj, py_dvi_is_connected); -STATIC mp_obj_t py_dvi_hotplug_callback(mp_obj_t self_in, mp_obj_t cb) { +static mp_obj_t py_dvi_hotplug_callback(mp_obj_t self_in, mp_obj_t cb) { py_tfp410_obj_t *self = MP_OBJ_TO_PTR(self_in); self->hotplug_callback = cb; @@ -87,7 +87,7 @@ STATIC mp_obj_t py_dvi_hotplug_callback(mp_obj_t self_in, mp_obj_t cb) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(py_dvi_hotplug_callback_obj, py_dvi_hotplug_callback); +static MP_DEFINE_CONST_FUN_OBJ_2(py_dvi_hotplug_callback_obj, py_dvi_hotplug_callback); mp_obj_t py_tfp410_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_i2c_addr }; @@ -99,8 +99,7 @@ mp_obj_t py_tfp410_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_k mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - py_tfp410_obj_t *self = m_new_obj_with_finaliser(py_tfp410_obj_t); - self->base.type = &py_tfp410_type; + py_tfp410_obj_t *self = mp_obj_malloc_with_finaliser(py_tfp410_obj_t, &py_tfp410_type); self->hotplug_callback = mp_const_none; self->i2c_addr = args[ARG_i2c_addr].u_int; self->i2c_bus = MP_OBJ_TYPE_GET_SLOT( @@ -123,7 +122,7 @@ mp_obj_t py_tfp410_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_k return MP_OBJ_FROM_PTR(self); } -STATIC mp_obj_t py_tfp410_deinit(mp_obj_t self_in) { +static mp_obj_t py_tfp410_deinit(mp_obj_t self_in) { omv_gpio_irq_enable(OMV_TFP410_INT_PIN, false); omv_gpio_write(OMV_TFP410_RESET_PIN, 0); @@ -135,9 +134,9 @@ STATIC mp_obj_t py_tfp410_deinit(mp_obj_t self_in) { omv_gpio_deinit(OMV_TFP410_RESET_PIN); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_tfp410_deinit_obj, py_tfp410_deinit); +static MP_DEFINE_CONST_FUN_OBJ_1(py_tfp410_deinit_obj, py_tfp410_deinit); -STATIC const mp_rom_map_elem_t py_tfp410_locals_dict_table[] = { +static const mp_rom_map_elem_t py_tfp410_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_tfp410) }, { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&py_tfp410_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR_isconnected), MP_ROM_PTR(&py_dvi_is_connected_obj) }, @@ -153,11 +152,11 @@ MP_DEFINE_CONST_OBJ_TYPE( locals_dict, &py_tfp410_locals_dict ); -STATIC const mp_rom_map_elem_t globals_dict_table[] = { +static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_tfp410) }, { MP_ROM_QSTR(MP_QSTR_TFP410), MP_ROM_PTR(&py_tfp410_type) }, }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t tfp410_module = { .base = { &mp_type_module }, diff --git a/src/omv/modules/py_tof.c b/src/omv/modules/py_tof.c index ce052eee1..2b1eb474a 100644 --- a/src/omv/modules/py_tof.c +++ b/src/omv/modules/py_tof.c @@ -199,7 +199,7 @@ static mp_obj_t py_tof_deinit() { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_tof_deinit_obj, py_tof_deinit); +static MP_DEFINE_CONST_FUN_OBJ_0(py_tof_deinit_obj, py_tof_deinit); mp_obj_t py_tof_init(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_type }; @@ -301,7 +301,7 @@ mp_obj_t py_tof_init(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_tof_init_obj, 0, py_tof_init); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_tof_init_obj, 0, py_tof_init); static mp_obj_t py_tof_type() { if (tof_sensor != TOF_NONE) { @@ -309,7 +309,7 @@ static mp_obj_t py_tof_type() { } mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("TOF sensor is not initialized")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_tof_type_obj, py_tof_type); +static MP_DEFINE_CONST_FUN_OBJ_0(py_tof_type_obj, py_tof_type); static mp_obj_t py_tof_width() { if (tof_sensor != TOF_NONE) { @@ -317,7 +317,7 @@ static mp_obj_t py_tof_width() { } mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("TOF sensor is not initialized")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_tof_width_obj, py_tof_width); +static MP_DEFINE_CONST_FUN_OBJ_0(py_tof_width_obj, py_tof_width); static mp_obj_t py_tof_height() { if (tof_sensor != TOF_NONE) { @@ -325,7 +325,7 @@ static mp_obj_t py_tof_height() { } mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("TOF sensor is not initialized")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_tof_height_obj, py_tof_height); +static MP_DEFINE_CONST_FUN_OBJ_0(py_tof_height_obj, py_tof_height); static mp_obj_t py_tof_refresh() { switch (tof_sensor) { @@ -337,7 +337,7 @@ static mp_obj_t py_tof_refresh() { mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("TOF sensor is not initialized")); } } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_tof_refresh_obj, py_tof_refresh); +static MP_DEFINE_CONST_FUN_OBJ_0(py_tof_refresh_obj, py_tof_refresh); mp_obj_t py_tof_read_depth(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_hmirror, ARG_vflip, ARG_transpose, ARG_timeout }; @@ -372,7 +372,7 @@ mp_obj_t py_tof_read_depth(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_a return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_tof_read_depth_obj, 0, py_tof_read_depth); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_tof_read_depth_obj, 0, py_tof_read_depth); mp_obj_t py_tof_draw_depth(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { @@ -446,7 +446,7 @@ mp_obj_t py_tof_draw_depth(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_a fb_alloc_free_till_mark(); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_tof_draw_depth_obj, 2, py_tof_draw_depth); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_tof_draw_depth_obj, 2, py_tof_draw_depth); mp_obj_t py_tof_snapshot(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { @@ -554,9 +554,9 @@ mp_obj_t py_tof_snapshot(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_arg } return py_image_from_struct(&dst_img); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_tof_snapshot_obj, 0, py_tof_snapshot); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_tof_snapshot_obj, 0, py_tof_snapshot); -STATIC const mp_rom_map_elem_t globals_dict_table[] = { +static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_tof) }, { MP_ROM_QSTR(MP_QSTR_TOF_NONE), MP_ROM_INT(TOF_NONE) }, #if (OMV_TOF_VL53L5CX_ENABLE == 1) @@ -577,7 +577,7 @@ STATIC const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_snapshot), MP_ROM_PTR(&py_tof_snapshot_obj) } }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t tof_module = { .base = { &mp_type_module }, diff --git a/src/omv/modules/py_tv.c b/src/omv/modules/py_tv.c index f6fe151bc..29e647fe6 100644 --- a/src/omv/modules/py_tv.c +++ b/src/omv/modules/py_tv.c @@ -744,7 +744,7 @@ static void spi_tv_display(image_t *src_img, int dst_x_start, int dst_y_start, f } #endif -STATIC mp_obj_t py_tv_deinit() { +static mp_obj_t py_tv_deinit() { switch (tv_type) { #ifdef OMV_SPI_DISPLAY_CONTROLLER case TV_SHIELD: { @@ -761,9 +761,9 @@ STATIC mp_obj_t py_tv_deinit() { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_tv_deinit_obj, py_tv_deinit); +static MP_DEFINE_CONST_FUN_OBJ_0(py_tv_deinit_obj, py_tv_deinit); -STATIC mp_obj_t py_tv_init(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_tv_init(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_type, ARG_triple_buffer }; static const mp_arg_t allowed_args[] = { { MP_QSTR_type, MP_ARG_INT, {.u_int = TV_SHIELD } }, @@ -790,50 +790,50 @@ STATIC mp_obj_t py_tv_init(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_a return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_tv_init_obj, 0, py_tv_init); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_tv_init_obj, 0, py_tv_init); -STATIC mp_obj_t py_tv_width() { +static mp_obj_t py_tv_width() { if (tv_type != TV_NONE) { return mp_obj_new_int(TV_WIDTH); } mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("TV controller is not initialized")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_tv_width_obj, py_tv_width); +static MP_DEFINE_CONST_FUN_OBJ_0(py_tv_width_obj, py_tv_width); -STATIC mp_obj_t py_tv_height() { +static mp_obj_t py_tv_height() { if (tv_type != TV_NONE) { return mp_obj_new_int(TV_HEIGHT); } mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("TV controller is not initialized")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_tv_height_obj, py_tv_height); +static MP_DEFINE_CONST_FUN_OBJ_0(py_tv_height_obj, py_tv_height); -STATIC mp_obj_t py_tv_type() { +static mp_obj_t py_tv_type() { if (tv_type != TV_NONE) { return mp_obj_new_int(tv_type); } mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("TV controller is not initialized")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_tv_type_obj, py_tv_type); +static MP_DEFINE_CONST_FUN_OBJ_0(py_tv_type_obj, py_tv_type); -STATIC mp_obj_t py_tv_triple_buffer() { +static mp_obj_t py_tv_triple_buffer() { if (tv_type != TV_NONE) { return mp_obj_new_int(tv_triple_buffer); } mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("TV controller is not initialized")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_tv_triple_buffer_obj, py_tv_triple_buffer); +static MP_DEFINE_CONST_FUN_OBJ_0(py_tv_triple_buffer_obj, py_tv_triple_buffer); -STATIC mp_obj_t py_tv_refresh() { +static mp_obj_t py_tv_refresh() { if (tv_type != TV_NONE) { return mp_obj_new_int(TV_REFRESH); } mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("TV controller is not initialized")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_tv_refresh_obj, py_tv_refresh); +static MP_DEFINE_CONST_FUN_OBJ_0(py_tv_refresh_obj, py_tv_refresh); -STATIC mp_obj_t py_tv_channel(uint n_args, const mp_obj_t *args) { +static mp_obj_t py_tv_channel(uint n_args, const mp_obj_t *args) { if (tv_type == TV_NONE) { mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("TV controller is not initialized")); } @@ -866,9 +866,9 @@ STATIC mp_obj_t py_tv_channel(uint n_args, const mp_obj_t *args) { } #endif } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_tv_channel_obj, 0, 1, py_tv_channel); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_tv_channel_obj, 0, 1, py_tv_channel); -STATIC mp_obj_t py_tv_display(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t py_tv_display(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_x, ARG_y, ARG_x_scale, ARG_y_scale, ARG_roi, ARG_channel, ARG_alpha, ARG_color_palette, ARG_alpha_palette, ARG_hint @@ -925,9 +925,9 @@ STATIC mp_obj_t py_tv_display(uint n_args, const mp_obj_t *pos_args, mp_map_t *k return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_tv_display_obj, 1, py_tv_display); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_tv_display_obj, 1, py_tv_display); -STATIC mp_obj_t py_tv_clear() { +static mp_obj_t py_tv_clear() { switch (tv_type) { #ifdef OMV_SPI_DISPLAY_CONTROLLER case TV_SHIELD: { @@ -945,9 +945,9 @@ STATIC mp_obj_t py_tv_clear() { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_tv_clear_obj, py_tv_clear); +static MP_DEFINE_CONST_FUN_OBJ_0(py_tv_clear_obj, py_tv_clear); -STATIC const mp_rom_map_elem_t globals_dict_table[] = { +static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_tv) }, { MP_ROM_QSTR(MP_QSTR_TV_NONE), MP_ROM_INT(TV_NONE) }, { MP_ROM_QSTR(MP_QSTR_TV_SHIELD), MP_ROM_INT(TV_SHIELD) }, @@ -963,7 +963,7 @@ STATIC const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&py_tv_clear_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t tv_module = { .base = { &mp_type_module }, diff --git a/src/omv/modules/ulab b/src/omv/modules/ulab index ac2e9954e..65c941a80 160000 --- a/src/omv/modules/ulab +++ b/src/omv/modules/ulab @@ -1 +1 @@ -Subproject commit ac2e9954edc185ec212e437e73e4b5e4290de35b +Subproject commit 65c941a8059afe1cfd6f4c2b15d0ade798dc24f2 diff --git a/src/omv/ports/mimxrt/main.c b/src/omv/ports/mimxrt/main.c index 655e38b44..dceaac20d 100644 --- a/src/omv/ports/mimxrt/main.c +++ b/src/omv/ports/mimxrt/main.c @@ -110,9 +110,8 @@ soft_reset: machine_rtc_start(); #if MICROPY_PY_LWIP - // lwIP doesn't allow to reinitialise itself by subsequent calls to this function - // because the system timeout list (next_timeout) is only ever reset by BSS clearing. - // So for now we only init the lwIP stack once on power-up. + // lwIP can only be initialized once, because the system timeout + // list (next_timeout), is only ever reset by BSS clearing. if (first_soft_reset) { lwip_init(); #if LWIP_MDNS_RESPONDER @@ -121,20 +120,19 @@ soft_reset: } systick_enable_dispatch(SYSTICK_DISPATCH_LWIP, mod_network_lwip_poll_wrapper); #endif + #if MICROPY_PY_BLUETOOTH mp_bluetooth_hci_init(); #endif #if MICROPY_PY_NETWORK_CYW43 - if (first_soft_reset) { - cyw43_init(&cyw43_state); - uint8_t buf[8]; - memcpy(&buf[0], "PYBD", 4); - mp_hal_get_mac_ascii(MP_HAL_MAC_WLAN0, 8, 4, (char *) &buf[4]); - cyw43_wifi_ap_set_ssid(&cyw43_state, 8, buf); - cyw43_wifi_ap_set_auth(&cyw43_state, CYW43_AUTH_WPA2_AES_PSK); - cyw43_wifi_ap_set_password(&cyw43_state, 8, (const uint8_t *) "pybd0123"); - } + cyw43_init(&cyw43_state); + uint8_t buf[8]; + memcpy(&buf[0], "PYBD", 4); + mp_hal_get_mac_ascii(MP_HAL_MAC_WLAN0, 8, 4, (char *) &buf[4]); + cyw43_wifi_ap_set_ssid(&cyw43_state, 8, buf); + cyw43_wifi_ap_set_auth(&cyw43_state, CYW43_AUTH_WPA2_AES_PSK); + cyw43_wifi_ap_set_password(&cyw43_state, 8, (const uint8_t *) "pybd0123"); #endif #if MICROPY_PY_NETWORK @@ -232,16 +230,6 @@ soft_reset: } else { mp_obj_print_exception(&mp_plat_print, (mp_obj_t) nlr.ret_val); } - - if (usbdbg_is_busy() && nlr_push(&nlr) == 0) { - // Enable IDE interrupt - usbdbg_set_irq_enabled(true); - // Wait for the current command to finish. - usbdbg_wait_for_command(1000); - // Disable IDE interrupts - usbdbg_set_irq_enabled(false); - nlr_pop(); - } } soft_reset_exit: @@ -260,6 +248,9 @@ soft_reset_exit: #if MICROPY_PY_NETWORK mod_network_deinit(); #endif + #if MICROPY_PY_NETWORK_CYW43 + cyw43_deinit(&cyw43_state); + #endif #if MICROPY_PY_MACHINE_I2S machine_i2s_deinit_all(); #endif diff --git a/src/omv/ports/mimxrt/omv_mpconfigport.h b/src/omv/ports/mimxrt/omv_mpconfigport.h index b0c7ad879..4f2bdf2fd 100644 --- a/src/omv/ports/mimxrt/omv_mpconfigport.h +++ b/src/omv/ports/mimxrt/omv_mpconfigport.h @@ -1,10 +1,12 @@ #include -#define MICROPY_GC_SPLIT_HEAP (1) #define MICROPY_NLR_RAISE_HOOK \ do { \ extern void fb_alloc_free_till_mark(); \ fb_alloc_free_till_mark(); \ } while (0); +#define MICROPY_ENABLE_VM_ABORT (1) +#define MICROPY_GC_SPLIT_HEAP (1) +#define CYW43_CHIPSET_FIRMWARE_INCLUDE_FILE "lib/cyw43-driver/firmware/w4343WA1_7_45_98_102_combined.h" #define MICROPY_BANNER_NAME_AND_VERSION "OpenMV " OPENMV_GIT_TAG "; MicroPython " MICROPY_GIT_TAG diff --git a/src/omv/ports/mimxrt/omv_portconfig.mk b/src/omv/ports/mimxrt/omv_portconfig.mk index 5ec411ebb..7a84c01e6 100644 --- a/src/omv/ports/mimxrt/omv_portconfig.mk +++ b/src/omv/ports/mimxrt/omv_portconfig.mk @@ -36,8 +36,8 @@ CFLAGS += -DCPU_$(MCU_VARIANT) \ -DCLOCK_CONFIG_H='' \ -DCSI_DRIVER_FRAG_MODE=1 \ -D__START=main \ - -D__STARTUP_CLEAR_BSS\ - -D__STARTUP_INITIALIZE_RAMFUNCTION\ + -D__STARTUP_CLEAR_BSS \ + -D__STARTUP_INITIALIZE_RAMFUNCTION \ $(OMV_BOARD_EXTRA_CFLAGS) # Linker Flags @@ -79,7 +79,9 @@ endif MICROPY_ARGS += MCU_DIR=$(TOP_DIR)/$(HAL_DIR) \ CMSIS_DIR=$(TOP_DIR)/$(CMSIS_DIR)\ SUPPORTS_HARDWARE_FP_SINGLE=1 \ - MICROPY_VFS_LFS2=0 + MICROPY_VFS_LFS2=0 \ + MICROPY_PY_OPENAMP=$(MICROPY_PY_OPENAMP)\ + MICROPY_PY_OPENAMP_REMOTEPROC=$(MICROPY_PY_OPENAMP_REMOTEPROC) OMV_CFLAGS += -I$(OMV_BOARD_CONFIG_DIR) OMV_CFLAGS += -I$(TOP_DIR)/$(OMV_DIR)/ @@ -325,51 +327,61 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/tinyusb/src/, \ ) FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/,\ - machine_adc.o \ - machine_adc_block.o \ - machine_bitstream.o \ - machine_i2c.o \ - machine_i2s.o \ - machine_mem.o \ - machine_pinbase.o \ - machine_pulse.o \ - machine_pwm.o \ - machine_signal.o \ - machine_spi.o \ - machine_timer.o \ - machine_uart.o \ - machine_wdt.o \ - modframebuf.o \ - modmachine.o \ - modnetwork.o \ - modonewire.o \ - modasyncio.o \ - modbinascii.o \ - modcryptolib.o \ - moddeflate.o \ - moductypes.o \ - modhashlib.o \ - modheapq.o \ - modjson.o \ - modos.o \ - modplatform.o \ - modrandom.o \ - modre.o \ - modselect.o \ - modsocket.o \ - modssl_axtls.o \ - modssl_mbedtls.o \ - modtime.o \ - os_dupterm.o \ - vfs_blockdev.o \ - vfs_fat_diskio.o \ - vfs_fat_file.o \ - vfs_fat.o \ - vfs.o \ - vfs_posix_file.o \ - vfs_posix.o \ - vfs_reader.o \ - virtpin.o \ + machine_adc.o \ + machine_adc_block.o \ + machine_bitstream.o \ + machine_i2c.o \ + machine_i2s.o \ + machine_mem.o \ + machine_pinbase.o \ + machine_pulse.o \ + machine_pwm.o \ + machine_signal.o \ + machine_spi.o \ + machine_timer.o \ + machine_uart.o \ + machine_usb_device.o \ + machine_wdt.o \ + modasyncio.o \ + modbinascii.o \ + modbtree.o \ + modcryptolib.o \ + moddeflate.o \ + modframebuf.o \ + modhashlib.o \ + modheapq.o \ + modjson.o \ + modmachine.o \ + modnetwork.o \ + modonewire.o \ + modopenamp.o \ + modopenamp_remoteproc.o \ + modopenamp_remoteproc_store.o \ + modos.o \ + modplatform.o \ + modrandom.o \ + modre.o \ + modselect.o \ + modsocket.o \ + modtls_axtls.o \ + modtls_mbedtls.o \ + modtime.o \ + moductypes.o \ + modvfs.o \ + network_esp_hosted.o \ + network_ninaw10.o \ + network_wiznet5k.o \ + os_dupterm.o \ + vfs.o \ + vfs_blockdev.o \ + vfs_fat.o \ + vfs_fat_diskio.o \ + vfs_fat_file.o \ + vfs_lfs.o \ + vfs_posix.o \ + vfs_posix_file.o \ + vfs_reader.o \ + virtpin.o \ ) FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/lib/oofatfs/,\ @@ -383,37 +395,39 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/drivers/,\ ) ifeq ($(MICROPY_PY_ULAB), 1) -FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/ulab/,\ - code/ndarray.o \ - code/ndarray_operators.o \ - code/ndarray_properties.o \ - code/numpy/approx.o \ - code/numpy/carray/carray.o \ - code/numpy/carray/carray_tools.o \ - code/numpy/compare.o \ - code/numpy/create.o \ - code/numpy/fft/fft.o \ - code/numpy/fft/fft_tools.o \ - code/numpy/filter.o \ - code/numpy/io/io.o \ - code/numpy/linalg/linalg.o \ - code/numpy/linalg/linalg_tools.o \ - code/numpy/ndarray/ndarray_iter.o \ - code/numpy/numerical.o \ - code/numpy/numpy.o \ - code/numpy/poly.o \ - code/numpy/stats.o \ - code/numpy/transform.o \ - code/numpy/vector.o \ - code/scipy/linalg/linalg.o \ - code/scipy/optimize/optimize.o \ - code/scipy/scipy.o \ - code/scipy/signal/signal.o \ - code/scipy/special/special.o \ - code/ulab.o \ - code/ulab_tools.o \ - code/user/user.o \ - code/utils/utils.o \ +FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/ulab/code/,\ + ndarray.o \ + ndarray_operators.o \ + ndarray_properties.o \ + numpy/approx.o \ + numpy/bitwise.o \ + numpy/carray/carray.o \ + numpy/carray/carray_tools.o \ + numpy/compare.o \ + numpy/create.o \ + numpy/fft/fft.o \ + numpy/fft/fft_tools.o \ + numpy/filter.o \ + numpy/io/io.o \ + numpy/linalg/linalg.o \ + numpy/linalg/linalg_tools.o \ + numpy/ndarray/ndarray_iter.o \ + numpy/numerical.o \ + numpy/numpy.o \ + numpy/poly.o \ + numpy/random/random.o \ + numpy/stats.o \ + numpy/transform.o \ + numpy/vector.o \ + scipy/linalg/linalg.o \ + scipy/optimize/optimize.o \ + scipy/scipy.o \ + scipy/signal/signal.o \ + scipy/special/special.o \ + ulab.o \ + ulab_tools.o \ + user/user.o \ + utils/utils.o \ ) endif @@ -461,6 +475,40 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\ ) endif +ifeq ($(MICROPY_PY_OPENAMP),1) +FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/openamp/metal/,\ + device.o \ + dma.o \ + init.o \ + io.o \ + irq.o \ + log.o \ + shmem.o \ + softirq.o \ + version.o \ + system/micropython/condition.o \ + system/micropython/device.o \ + system/micropython/io.o \ + system/micropython/irq.o \ + system/micropython/shmem.o \ + system/micropython/time.o \ + ) + +FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\ + mpmetalport.o \ + mpremoteprocport.o \ + lib/open-amp/lib/virtio/virtio.o \ + lib/open-amp/lib/virtio/virtqueue.o \ + lib/open-amp/lib/virtio_mmio/virtio_mmio_drv.o \ + lib/open-amp/lib/rpmsg/rpmsg.o \ + lib/open-amp/lib/rpmsg/rpmsg_virtio.o \ + lib/open-amp/lib/remoteproc/elf_loader.o \ + lib/open-amp/lib/remoteproc/remoteproc.o \ + lib/open-amp/lib/remoteproc/remoteproc_virtio.o \ + lib/open-amp/lib/remoteproc/rsc_table_parser.o \ + ) +endif + ################################################### #Export Variables export Q diff --git a/src/omv/ports/nrf/main.c b/src/omv/ports/nrf/main.c index 4d0c774a5..a36c57e04 100644 --- a/src/omv/ports/nrf/main.c +++ b/src/omv/ports/nrf/main.c @@ -101,7 +101,7 @@ extern uint32_t _heap_start; extern uint32_t _heap_end; #if MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE -STATIC int vfs_mount_and_chdir(mp_obj_t bdev, mp_obj_t mount_point) { +static int vfs_mount_and_chdir(mp_obj_t bdev, mp_obj_t mount_point) { nlr_buf_t nlr; mp_int_t ret = -MP_EIO; if (nlr_push(&nlr) == 0) { @@ -315,16 +315,6 @@ soft_reset: } else { mp_obj_print_exception(&mp_plat_print, (mp_obj_t) nlr.ret_val); } - - if (usbdbg_is_busy() && nlr_push(&nlr) == 0) { - // Enable IDE interrupt - usbdbg_set_irq_enabled(true); - // Wait for the current command to finish. - usbdbg_wait_for_command(1000); - // Disable IDE interrupts - usbdbg_set_irq_enabled(false); - nlr_pop(); - } } soft_reset_exit: diff --git a/src/omv/ports/nrf/modules/py_audio.c b/src/omv/ports/nrf/modules/py_audio.c index 3fc561551..4373108eb 100644 --- a/src/omv/ports/nrf/modules/py_audio.c +++ b/src/omv/ports/nrf/modules/py_audio.c @@ -133,7 +133,7 @@ static mp_obj_t py_audio_init(uint n_args, const mp_obj_t *pos_args, mp_map_t *k nrfx_pdm_init(&nrfx_pdm_config, nrfx_pdm_event_handler); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_audio_init_obj, 0, py_audio_init); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_audio_init_obj, 0, py_audio_init); void py_audio_deinit() { // Disable PDM and IRQ @@ -172,7 +172,7 @@ static mp_obj_t py_audio_start_streaming(mp_obj_t callback_obj) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_audio_start_streaming_obj, py_audio_start_streaming); +static MP_DEFINE_CONST_FUN_OBJ_1(py_audio_start_streaming_obj, py_audio_start_streaming); static mp_obj_t py_audio_stop_streaming() { // Stop PDM. @@ -180,7 +180,7 @@ static mp_obj_t py_audio_stop_streaming() { g_audio_callback = mp_const_none; return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_audio_stop_streaming_obj, py_audio_stop_streaming); +static MP_DEFINE_CONST_FUN_OBJ_0(py_audio_stop_streaming_obj, py_audio_stop_streaming); static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audio) }, @@ -189,7 +189,7 @@ static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_stop_streaming), MP_ROM_PTR(&py_audio_stop_streaming_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t audio_module = { .base = { &mp_type_module }, diff --git a/src/omv/ports/nrf/omv_mpconfigport.h b/src/omv/ports/nrf/omv_mpconfigport.h index c5fd9d9ed..3b08f39e6 100644 --- a/src/omv/ports/nrf/omv_mpconfigport.h +++ b/src/omv/ports/nrf/omv_mpconfigport.h @@ -6,4 +6,5 @@ fb_alloc_free_till_mark(); \ } while (0); +#define MICROPY_ENABLE_VM_ABORT (1) #define MICROPY_BANNER_NAME_AND_VERSION "OpenMV " OPENMV_GIT_TAG "; MicroPython " MICROPY_GIT_TAG diff --git a/src/omv/ports/nrf/omv_portconfig.mk b/src/omv/ports/nrf/omv_portconfig.mk index 0411fc6a0..0946f821d 100644 --- a/src/omv/ports/nrf/omv_portconfig.mk +++ b/src/omv/ports/nrf/omv_portconfig.mk @@ -228,7 +228,8 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/,\ modheapq.o \ modbinascii.o \ modrandom.o \ - modtime.o \ + modtime.o \ + modvfs.o \ os_dupterm.o \ modmachine.o \ modos.o \ @@ -320,37 +321,39 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/,\ ) ifeq ($(MICROPY_PY_ULAB), 1) -FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/ulab/,\ - code/ndarray.o \ - code/ndarray_operators.o \ - code/ndarray_properties.o \ - code/numpy/approx.o \ - code/numpy/carray/carray.o \ - code/numpy/carray/carray_tools.o \ - code/numpy/compare.o \ - code/numpy/create.o \ - code/numpy/fft/fft.o \ - code/numpy/fft/fft_tools.o \ - code/numpy/filter.o \ - code/numpy/io/io.o \ - code/numpy/linalg/linalg.o \ - code/numpy/linalg/linalg_tools.o \ - code/numpy/ndarray/ndarray_iter.o \ - code/numpy/numerical.o \ - code/numpy/numpy.o \ - code/numpy/poly.o \ - code/numpy/stats.o \ - code/numpy/transform.o \ - code/numpy/vector.o \ - code/scipy/linalg/linalg.o \ - code/scipy/optimize/optimize.o \ - code/scipy/scipy.o \ - code/scipy/signal/signal.o \ - code/scipy/special/special.o \ - code/ulab.o \ - code/ulab_tools.o \ - code/user/user.o \ - code/utils/utils.o \ +FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/ulab/code/,\ + ndarray.o \ + ndarray_operators.o \ + ndarray_properties.o \ + numpy/approx.o \ + numpy/bitwise.o \ + numpy/carray/carray.o \ + numpy/carray/carray_tools.o \ + numpy/compare.o \ + numpy/create.o \ + numpy/fft/fft.o \ + numpy/fft/fft_tools.o \ + numpy/filter.o \ + numpy/io/io.o \ + numpy/linalg/linalg.o \ + numpy/linalg/linalg_tools.o \ + numpy/ndarray/ndarray_iter.o \ + numpy/numerical.o \ + numpy/numpy.o \ + numpy/poly.o \ + numpy/random/random.o \ + numpy/stats.o \ + numpy/transform.o \ + numpy/vector.o \ + scipy/linalg/linalg.o \ + scipy/optimize/optimize.o \ + scipy/scipy.o \ + scipy/signal/signal.o \ + scipy/special/special.o \ + ulab.o \ + ulab_tools.o \ + user/user.o \ + utils/utils.o \ ) endif diff --git a/src/omv/ports/rp2/main.c b/src/omv/ports/rp2/main.c index d048198d6..91c8dc9b8 100644 --- a/src/omv/ports/rp2/main.c +++ b/src/omv/ports/rp2/main.c @@ -180,17 +180,9 @@ soft_reset: } #endif + // Execute _boot.py to set up the filesystem. #if MICROPY_VFS_FAT && MICROPY_HW_USB_MSC - // Mount or create a fresh filesystem. - mp_obj_t mount_point = MP_OBJ_NEW_QSTR(MP_QSTR__slash_); - mp_obj_t bdev = MP_OBJ_TYPE_GET_SLOT(&rp2_flash_type, make_new) (&rp2_flash_type, 0, 0, NULL); - if (mp_vfs_mount_and_chdir_protected(bdev, mount_point) == -MP_ENODEV) { - // Create a fresh filesystem. - fs_user_mount_t *vfs = MP_OBJ_TYPE_GET_SLOT(&mp_fat_vfs_type, make_new) (&mp_fat_vfs_type, 1, 0, &bdev); - if (mp_init_filesystem(vfs) == 0) { - mp_vfs_mount_and_chdir_protected(bdev, mount_point); - } - } + pyexec_frozen_module("_boot_fat.py", false); #else pyexec_frozen_module("_boot.py", false); #endif @@ -253,16 +245,6 @@ soft_reset: } else { mp_obj_print_exception(&mp_plat_print, (mp_obj_t) nlr.ret_val); } - - if (usbdbg_is_busy() && nlr_push(&nlr) == 0) { - // Enable IDE interrupt - usbdbg_set_irq_enabled(true); - // Wait for the current command to finish. - usbdbg_wait_for_command(1000); - // Disable IDE interrupts - usbdbg_set_irq_enabled(false); - nlr_pop(); - } } soft_reset_exit: diff --git a/src/omv/ports/rp2/modules/py_audio.c b/src/omv/ports/rp2/modules/py_audio.c index e2f589039..4a1ec0bb5 100644 --- a/src/omv/ports/rp2/modules/py_audio.c +++ b/src/omv/ports/rp2/modules/py_audio.c @@ -284,17 +284,17 @@ static mp_obj_t py_audio_init(uint n_args, const mp_obj_t *pos_args, mp_map_t *k audio_initialized = true; return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_audio_init_obj, 0, py_audio_init); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_audio_init_obj, 0, py_audio_init); static mp_obj_t py_audio_samples() { return mp_obj_new_int(audio_data->t_samples); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_audio_samples_obj, py_audio_samples); +static MP_DEFINE_CONST_FUN_OBJ_0(py_audio_samples_obj, py_audio_samples); static mp_obj_t py_audio_overflow() { return mp_obj_new_bool(audio_data->overflow); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_audio_overflow_obj, py_audio_overflow); +static MP_DEFINE_CONST_FUN_OBJ_0(py_audio_overflow_obj, py_audio_overflow); static mp_obj_t py_audio_start_streaming(mp_obj_t callback_obj) { audio_data->head = 0; @@ -321,7 +321,7 @@ static mp_obj_t py_audio_start_streaming(mp_obj_t callback_obj) { audio_data->streaming = true; return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_audio_start_streaming_obj, py_audio_start_streaming); +static MP_DEFINE_CONST_FUN_OBJ_1(py_audio_start_streaming_obj, py_audio_start_streaming); static mp_obj_t py_audio_stop_streaming() { if (audio_data->streaming) { @@ -354,7 +354,7 @@ static mp_obj_t py_audio_stop_streaming() { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_audio_stop_streaming_obj, py_audio_stop_streaming); +static MP_DEFINE_CONST_FUN_OBJ_0(py_audio_stop_streaming_obj, py_audio_stop_streaming); static mp_obj_t py_audio_get_buffer(uint n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { @@ -395,7 +395,7 @@ static mp_obj_t py_audio_get_buffer(uint n_args, const mp_obj_t *pos_args, mp_ma // Return PCM buffer. return MP_OBJ_FROM_PTR(audio_data->pcm_buffer_user); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_audio_get_buffer_obj, 0, py_audio_get_buffer); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_audio_get_buffer_obj, 0, py_audio_get_buffer); void py_audio_deinit() { if (audio_initialized) { @@ -432,7 +432,7 @@ static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_get_buffer), MP_ROM_PTR(&py_audio_get_buffer_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t audio_module = { .base = { &mp_type_module }, diff --git a/src/omv/ports/rp2/omv_mpconfigport.h b/src/omv/ports/rp2/omv_mpconfigport.h index c5fd9d9ed..3b08f39e6 100644 --- a/src/omv/ports/rp2/omv_mpconfigport.h +++ b/src/omv/ports/rp2/omv_mpconfigport.h @@ -6,4 +6,5 @@ fb_alloc_free_till_mark(); \ } while (0); +#define MICROPY_ENABLE_VM_ABORT (1) #define MICROPY_BANNER_NAME_AND_VERSION "OpenMV " OPENMV_GIT_TAG "; MicroPython " MICROPY_GIT_TAG diff --git a/src/omv/ports/rp2/omv_portconfig.cmake b/src/omv/ports/rp2/omv_portconfig.cmake index b306ff3a6..5651a5b79 100644 --- a/src/omv/ports/rp2/omv_portconfig.cmake +++ b/src/omv/ports/rp2/omv_portconfig.cmake @@ -25,6 +25,10 @@ set(MICROPY_MANIFEST_OMV_LIB_DIR ${TOP_DIR}/../scripts/libraries) # Include board cmake fragment include(${OMV_BOARD_CONFIG_DIR}/omv_boardconfig.cmake) +get_target_property(MICROPY_SOURCES ${MICROPY_TARGET} SOURCES) +list(REMOVE_ITEM MICROPY_SOURCES pendsv.c main.c) +set_property(TARGET ${MICROPY_TARGET} PROPERTY SOURCES ${MICROPY_SOURCES}) + target_link_options(${MICROPY_TARGET} PRIVATE -Wl,--wrap=tud_cdc_rx_cb -Wl,--wrap=mp_hal_stdout_tx_strn @@ -234,6 +238,7 @@ if(MICROPY_PY_ULAB) ${MICROPY_ULAB_DIR}/code/ndarray_operators.c ${MICROPY_ULAB_DIR}/code/ndarray_properties.c ${MICROPY_ULAB_DIR}/code/numpy/approx.c + ${MICROPY_ULAB_DIR}/code/numpy/bitwise.c ${MICROPY_ULAB_DIR}/code/numpy/carray/carray.c ${MICROPY_ULAB_DIR}/code/numpy/carray/carray_tools.c ${MICROPY_ULAB_DIR}/code/numpy/compare.c @@ -248,6 +253,7 @@ if(MICROPY_PY_ULAB) ${MICROPY_ULAB_DIR}/code/numpy/numerical.c ${MICROPY_ULAB_DIR}/code/numpy/numpy.c ${MICROPY_ULAB_DIR}/code/numpy/poly.c + ${MICROPY_ULAB_DIR}/code/numpy/random/random.c ${MICROPY_ULAB_DIR}/code/numpy/stats.c ${MICROPY_ULAB_DIR}/code/numpy/transform.c ${MICROPY_ULAB_DIR}/code/numpy/vector.c diff --git a/src/omv/ports/stm32/main.c b/src/omv/ports/stm32/main.c index ee7177629..1168b0282 100644 --- a/src/omv/ports/stm32/main.c +++ b/src/omv/ports/stm32/main.c @@ -276,11 +276,6 @@ soft_reset: // Initialize the stack and GC memory. mp_init_gc_stack(&_sstack, &_estack, &_heap_start, &_heap_end, 1024); - #if MICROPY_ENABLE_PYSTACK - static mp_obj_t pystack[384]; - mp_pystack_init(pystack, &pystack[384]); - #endif - // Micro Python init mp_init(); @@ -321,9 +316,8 @@ soft_reset: #endif rtc_init_start(false); #if MICROPY_PY_LWIP - // lwIP doesn't allow to reinitialise itself by subsequent calls to this function - // because the system timeout list (next_timeout) is only ever reset by BSS clearing. - // So for now we only init the lwIP stack once on power-up. + // lwIP can only be initialized once, because the system timeout + // list (next_timeout), is only ever reset by BSS clearing. if (first_soft_reset) { lwip_init(); #if LWIP_MDNS_RESPONDER @@ -332,20 +326,19 @@ soft_reset: } systick_enable_dispatch(SYSTICK_DISPATCH_LWIP, mod_network_lwip_poll_wrapper); #endif + #if MICROPY_PY_BLUETOOTH mp_bluetooth_hci_init(); #endif #if MICROPY_PY_NETWORK_CYW43 - if (first_soft_reset) { - cyw43_init(&cyw43_state); - uint8_t buf[8]; - memcpy(&buf[0], "PYBD", 4); - mp_hal_get_mac_ascii(MP_HAL_MAC_WLAN0, 8, 4, (char *) &buf[4]); - cyw43_wifi_ap_set_ssid(&cyw43_state, 8, buf); - cyw43_wifi_ap_set_auth(&cyw43_state, CYW43_AUTH_WPA2_AES_PSK); - cyw43_wifi_ap_set_password(&cyw43_state, 8, (const uint8_t *) "pybd0123"); - } + cyw43_init(&cyw43_state); + uint8_t buf[8]; + memcpy(&buf[0], "PYBD", 4); + mp_hal_get_mac_ascii(MP_HAL_MAC_WLAN0, 8, 4, (char *) &buf[4]); + cyw43_wifi_ap_set_ssid(&cyw43_state, 8, buf); + cyw43_wifi_ap_set_auth(&cyw43_state, CYW43_AUTH_WPA2_AES_PSK); + cyw43_wifi_ap_set_password(&cyw43_state, 8, (const uint8_t *) "pybd0123"); #endif pyb_usb_init0(); @@ -361,10 +354,9 @@ soft_reset: py_imu_init(); #endif // MICROPY_PY_IMU + #if MICROPY_PY_NETWORK mod_network_init(); - - // Remove the BASEPRI masking (if any) - irq_set_base_priority(0); + #endif #if MICROPY_HW_ENABLE_SDCARD // Initialize storage @@ -462,9 +454,7 @@ else { // report if SDRAM failed #if MICROPY_HW_SDRAM_SIZE if (first_soft_reset && (!sdram_ok)) { - char buf[512]; - snprintf(buf, sizeof(buf), "Failed to init sdram!"); - __fatal_error(buf); + __fatal_error("Failed to init sdram!"); } #endif @@ -532,20 +522,7 @@ else { usbdbg_set_irq_enabled(false); nlr_pop(); } else { - mp_obj_print_exception(&mp_plat_print, (mp_obj_t) nlr.ret_val); - } - - if (usbdbg_is_busy() && nlr_push(&nlr) == 0) { - // Enable IDE interrupt - usbdbg_set_irq_enabled(true); - #if OMV_WIFIDBG_ENABLE && MICROPY_PY_WINC1500 - wifidbg_set_irq_enabled(openmv_config.wifidbg); - #endif - // Wait for the current command to finish. - usbdbg_wait_for_command(1000); - // Disable IDE interrupts - usbdbg_set_irq_enabled(false); - nlr_pop(); + mp_obj_print_exception(MP_PYTHON_PRINTER, (mp_obj_t) nlr.ret_val); } } @@ -553,19 +530,11 @@ else { soft_reset_exit: // soft reset - mp_printf(&mp_plat_print, "MPY: soft reboot\n"); + mp_printf(MP_PYTHON_PRINTER, "MPY: soft reboot\n"); // Flush filesystem storage. storage_flush(); - // Call GC sweep first, before deinitializing networking drivers - // such as WINC/CYW43 which need to be active to close sockets - // when their finalizers are called by GC. - gc_sweep_all(); - - // Disable all other IRQs except Systick - irq_set_base_priority(IRQ_PRI_SYSTICK + 1); - #if MICROPY_PY_LWIP systick_disable_dispatch(SYSTICK_DISPATCH_LWIP); #endif @@ -575,6 +544,9 @@ soft_reset_exit: #if MICROPY_PY_NETWORK mod_network_deinit(); #endif + #if MICROPY_PY_NETWORK_CYW43 + cyw43_deinit(&cyw43_state); + #endif timer_deinit(); i2c_deinit_all(); spi_deinit_all(); @@ -589,9 +561,8 @@ soft_reset_exit: py_audio_deinit(); #endif imlib_deinit_all(); - + gc_sweep_all(); mp_deinit(); - first_soft_reset = false; goto soft_reset; } diff --git a/src/omv/ports/stm32/modules/py_audio.c b/src/omv/ports/stm32/modules/py_audio.c index f410a760c..e579839c3 100644 --- a/src/omv/ports/stm32/modules/py_audio.c +++ b/src/omv/ports/stm32/modules/py_audio.c @@ -361,7 +361,7 @@ static mp_obj_t py_audio_init(uint n_args, const mp_obj_t *pos_args, mp_map_t *k return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_audio_init_obj, 0, py_audio_init); +static MP_DEFINE_CONST_FUN_OBJ_KW(py_audio_init_obj, 0, py_audio_init); void py_audio_deinit() { #if defined(OMV_SAI) @@ -472,7 +472,7 @@ static mp_obj_t py_audio_start_streaming(mp_obj_t callback_obj) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_audio_start_streaming_obj, py_audio_start_streaming); +static MP_DEFINE_CONST_FUN_OBJ_1(py_audio_start_streaming_obj, py_audio_start_streaming); static mp_obj_t py_audio_stop_streaming() { #if defined(OMV_SAI) @@ -488,7 +488,7 @@ static mp_obj_t py_audio_stop_streaming() { MP_STATE_PORT(audio_callback) = mp_const_none; return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_audio_stop_streaming_obj, py_audio_stop_streaming); +static MP_DEFINE_CONST_FUN_OBJ_0(py_audio_stop_streaming_obj, py_audio_stop_streaming); #if defined(OMV_SAI) static mp_obj_t py_audio_read_pdm(mp_obj_t buf_in) { @@ -542,7 +542,7 @@ static mp_obj_t py_audio_read_pdm(mp_obj_t buf_in) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_audio_read_pdm_obj, py_audio_read_pdm); +static MP_DEFINE_CONST_FUN_OBJ_1(py_audio_read_pdm_obj, py_audio_read_pdm); #endif static const mp_rom_map_elem_t globals_dict_table[] = { @@ -555,7 +555,7 @@ static const mp_rom_map_elem_t globals_dict_table[] = { #endif }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t audio_module = { .base = { &mp_type_module }, diff --git a/src/omv/ports/stm32/modules/py_buzzer.c b/src/omv/ports/stm32/modules/py_buzzer.c index 572135094..804e60e60 100644 --- a/src/omv/ports/stm32/modules/py_buzzer.c +++ b/src/omv/ports/stm32/modules/py_buzzer.c @@ -62,7 +62,7 @@ static void buzzer_setup(int freq, int duty) { buzzer_duty = duty; } -STATIC mp_obj_t py_buzzer_freq(uint n_args, const mp_obj_t *args) { +static mp_obj_t py_buzzer_freq(uint n_args, const mp_obj_t *args) { if (!n_args) { return mp_obj_new_int(buzzer_freq); } else { @@ -70,9 +70,9 @@ STATIC mp_obj_t py_buzzer_freq(uint n_args, const mp_obj_t *args) { return mp_const_none; } } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_buzzer_freq_obj, 0, 1, py_buzzer_freq); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_buzzer_freq_obj, 0, 1, py_buzzer_freq); -STATIC mp_obj_t py_buzzer_duty(uint n_args, const mp_obj_t *args) { +static mp_obj_t py_buzzer_duty(uint n_args, const mp_obj_t *args) { if (!n_args) { return mp_obj_new_int(buzzer_duty); } else { @@ -80,7 +80,7 @@ STATIC mp_obj_t py_buzzer_duty(uint n_args, const mp_obj_t *args) { return mp_const_none; } } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_buzzer_duty_obj, 0, 1, py_buzzer_duty); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(py_buzzer_duty_obj, 0, 1, py_buzzer_duty); static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_buzzer) }, @@ -89,7 +89,7 @@ static const mp_rom_map_elem_t globals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_duty), MP_ROM_PTR(&py_buzzer_duty_obj) } }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t buzzer_module = { .base = { &mp_type_module }, diff --git a/src/omv/ports/stm32/modules/py_cpufreq.c b/src/omv/ports/stm32/modules/py_cpufreq.c index dc55c1f7e..6e0f529cf 100644 --- a/src/omv/ports/stm32/modules/py_cpufreq.c +++ b/src/omv/ports/stm32/modules/py_cpufreq.c @@ -223,9 +223,9 @@ mp_obj_t py_cpufreq_set_frequency(mp_obj_t cpufreq_obj) { return mp_const_true; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_cpufreq_set_frequency_obj, py_cpufreq_set_frequency); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_cpufreq_get_current_frequencies_obj, py_cpufreq_get_current_frequencies); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(py_cpufreq_get_supported_frequencies_obj, py_cpufreq_get_supported_frequencies); +static MP_DEFINE_CONST_FUN_OBJ_1(py_cpufreq_set_frequency_obj, py_cpufreq_set_frequency); +static MP_DEFINE_CONST_FUN_OBJ_0(py_cpufreq_get_current_frequencies_obj, py_cpufreq_get_current_frequencies); +static MP_DEFINE_CONST_FUN_OBJ_0(py_cpufreq_get_supported_frequencies_obj, py_cpufreq_get_supported_frequencies); #endif // defined(STM32F7) || defined(STM32H7) static const mp_map_elem_t globals_dict_table[] = { @@ -241,7 +241,7 @@ static const mp_map_elem_t globals_dict_table[] = { #endif { NULL, NULL }, }; -STATIC MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); +static MP_DEFINE_CONST_DICT(globals_dict, globals_dict_table); const mp_obj_module_t cpufreq_module = { .base = { &mp_type_module }, diff --git a/src/omv/ports/stm32/modules/py_display.c b/src/omv/ports/stm32/modules/py_display.c index 5f3e8b363..888e3ba0f 100644 --- a/src/omv/ports/stm32/modules/py_display.c +++ b/src/omv/ports/stm32/modules/py_display.c @@ -577,11 +577,11 @@ mp_obj_t display_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("Invalid Refresh Rate!")); } - py_display_obj_t *self = (py_display_obj_t *) m_new_obj_with_finaliser(py_display_obj_t); + py_display_obj_t *self; #ifdef OMV_DSI_DISPLAY_CONTROLLER - self->base.type = &py_dsi_display_type; + self = mp_obj_malloc_with_finaliser(py_display_obj_t, &py_dsi_display_type); #else - self->base.type = &py_rgb_display_type; + self = mp_obj_malloc_with_finaliser(py_display_obj_t, &py_rgb_display_type); #endif self->vcid = args[ARG_channel].u_int; self->refresh = args[ARG_refresh].u_int; @@ -629,7 +629,7 @@ mp_obj_t display_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, return MP_OBJ_FROM_PTR(self); } -STATIC const py_display_p_t py_display_p = { +static const py_display_p_t py_display_p = { .deinit = display_deinit, .clear = display_clear, .write = display_write, diff --git a/src/omv/ports/stm32/modules/py_winc.c b/src/omv/ports/stm32/modules/py_winc.c index 168ea798b..332005391 100644 --- a/src/omv/ports/stm32/modules/py_winc.c +++ b/src/omv/ports/stm32/modules/py_winc.c @@ -583,7 +583,7 @@ static const mp_rom_map_elem_t winc_locals_dict_table[] = { static MP_DEFINE_CONST_DICT(winc_locals_dict, winc_locals_dict_table); -STATIC const mod_network_nic_protocol_t mod_network_nic_protocol_winc = { +static const mod_network_nic_protocol_t mod_network_nic_protocol_winc = { .gethostbyname = py_winc_gethostbyname, .socket = py_winc_socket_socket, .close = py_winc_socket_close, diff --git a/src/omv/ports/stm32/omv_mpconfigport.h b/src/omv/ports/stm32/omv_mpconfigport.h index aa5e24bd5..a618f1a55 100644 --- a/src/omv/ports/stm32/omv_mpconfigport.h +++ b/src/omv/ports/stm32/omv_mpconfigport.h @@ -6,6 +6,7 @@ fb_alloc_free_till_mark(); \ } while (0); +#define MICROPY_ENABLE_VM_ABORT (1) #define MICROPY_GC_SPLIT_HEAP (1) #define MICROPY_PY_SOCKET_EXTENDED_STATE (1) #define MICROPY_BANNER_NAME_AND_VERSION "OpenMV " OPENMV_GIT_TAG "; MicroPython " MICROPY_GIT_TAG diff --git a/src/omv/ports/stm32/omv_portconfig.mk b/src/omv/ports/stm32/omv_portconfig.mk index 8141f730e..c72fb44da 100644 --- a/src/omv/ports/stm32/omv_portconfig.mk +++ b/src/omv/ports/stm32/omv_portconfig.mk @@ -8,13 +8,13 @@ CFLAGS += -std=gnu99 \ -Wall \ -Werror \ -Warray-bounds \ - -mthumb \ -nostartfiles \ -fdata-sections \ -ffunction-sections \ -fno-inline-small-functions \ -fsingle-precision-constant \ -Wdouble-promotion \ + -mthumb \ -mcpu=$(CPU) \ -mtune=$(CPU) \ -mfpu=$(FPU) \ @@ -36,13 +36,13 @@ CFLAGS += -D$(MCU) \ $(OMV_BOARD_EXTRA_CFLAGS) # Linker Flags -LDFLAGS = -mcpu=$(CPU) \ - -mabi=aapcs-linux \ - -mthumb \ +LDFLAGS = -mthumb \ + -mcpu=$(CPU) \ -mfpu=$(FPU) \ -mfloat-abi=hard \ - -Wl,--gc-sections \ + -mabi=aapcs-linux \ -Wl,--print-memory-usage \ + -Wl,--gc-sections \ -Wl,-T$(BUILD)/$(LDSCRIPT).lds \ -Wl,-Map=$(BUILD)/$(FIRMWARE).map @@ -68,11 +68,13 @@ MPY_CFLAGS += -DMICROPY_PY_SSL=1 \ -DMICROPY_STREAMS_POSIX_API=1 \ -DMICROPY_VFS_FAT=1 -MICROPY_ARGS += MICROPY_PY_SSL=1 \ +MICROPY_ARGS += STM32LIB_CMSIS_DIR=$(TOP_DIR)/$(CMSIS_DIR) \ + STM32LIB_HAL_DIR=$(TOP_DIR)/$(HAL_DIR) \ + MICROPY_PY_SSL=1 \ MICROPY_SSL_MBEDTLS=1 \ MICROPY_PY_BTREE=1\ - STM32LIB_CMSIS_DIR=$(TOP_DIR)/$(CMSIS_DIR) \ - STM32LIB_HAL_DIR=$(TOP_DIR)/$(HAL_DIR) + MICROPY_PY_OPENAMP=$(MICROPY_PY_OPENAMP)\ + MICROPY_PY_OPENAMP_REMOTEPROC=$(MICROPY_PY_OPENAMP_REMOTEPROC) OMV_CFLAGS += -I$(OMV_BOARD_CONFIG_DIR) OMV_CFLAGS += -I$(TOP_DIR)/$(OMV_DIR)/ @@ -128,53 +130,6 @@ UVC_LDFLAGS = -mcpu=$(CPU) \ -Wl,-T$(BUILD)/$(UVC_DIR)/stm32fxxx.lds endif -ifeq ($(OMV_ENABLE_CM4), 1) -CFLAGS += -DM4_APP_ADDR=$(M4_APP_ADDR) -ifeq ($(DEBUG), 1) -CM4_CFLAGS += -Og -ggdb3 -Wno-maybe-uninitialized -else -CM4_CFLAGS += -O2 -DNDEBUG -endif -CM4_CFLAGS += -std=gnu99 \ - -Wall \ - -Werror \ - -Warray-bounds \ - -mthumb \ - -nostartfiles \ - -fdata-sections \ - -ffunction-sections \ - -fsingle-precision-constant \ - -Wdouble-promotion \ - -mcpu=cortex-m4 \ - -mtune=cortex-m4 \ - -mfpu=$(FPU) \ - -mfloat-abi=hard - -CM4_CFLAGS += -D$(MCU) \ - -D$(CFLAGS_MCU) \ - -DARM_NN_TRUNCATE \ - -DCORE_CM4 \ - -D__FPU_PRESENT=1 \ - -D__VFP_FP__ \ - -DHSE_VALUE=$(OMV_HSE_VALUE) \ - -D$(TARGET) \ - -DMAIN_APP_ADDR=$(M4_APP_ADDR) \ - -DSTM32_HAL_H=$(HAL_INC) \ - -DVECT_TAB_OFFSET=$(M4_VECT_TAB_OFFSET) \ - -CM4_CFLAGS += $(HAL_CFLAGS) -CM4_CFLAGS += -I$(OMV_BOARD_CONFIG_DIR) -CM4_CFLAGS += -I$(TOP_DIR)/$(CM4_DIR)/include/ -# Linker Flags -CM4_LDFLAGS = -mcpu=cortex-m4 \ - -mabi=aapcs-linux \ - -mthumb \ - -mfpu=$(FPU) \ - -mfloat-abi=hard \ - -Wl,--gc-sections \ - -Wl,-T$(BUILD)/$(CM4_DIR)/stm32fxxx.lds -endif - CFLAGS += $(HAL_CFLAGS) $(MPY_CFLAGS) $(OMV_CFLAGS) #------------- Libraries ----------------# @@ -325,6 +280,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\ usb.o \ usrsw.o \ eth.o \ + eth_phy.o \ help.o \ flash.o \ flashbdev.o \ @@ -422,6 +378,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/,\ machine_spi.o \ machine_timer.o \ machine_uart.o \ + machine_usb_device.o \ machine_wdt.o \ modasyncio.o \ modbinascii.o \ @@ -435,16 +392,20 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/extmod/,\ modmachine.o \ modnetwork.o \ modonewire.o \ + modopenamp.o \ + modopenamp_remoteproc.o \ + modopenamp_remoteproc_store.o \ modos.o \ modplatform.o\ modrandom.o \ modre.o \ modselect.o \ modsocket.o \ - modssl_axtls.o \ - modssl_mbedtls.o \ + modtls_axtls.o \ + modtls_mbedtls.o \ modtime.o \ moductypes.o \ + modvfs.o \ network_esp_hosted.o \ network_ninaw10.o \ network_wiznet5k.o \ @@ -473,37 +434,39 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/drivers/,\ ) ifeq ($(MICROPY_PY_ULAB), 1) -FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/ulab/,\ - code/ndarray.o \ - code/ndarray_operators.o \ - code/ndarray_properties.o \ - code/numpy/approx.o \ - code/numpy/carray/carray.o \ - code/numpy/carray/carray_tools.o \ - code/numpy/compare.o \ - code/numpy/create.o \ - code/numpy/fft/fft.o \ - code/numpy/fft/fft_tools.o \ - code/numpy/filter.o \ - code/numpy/io/io.o \ - code/numpy/linalg/linalg.o \ - code/numpy/linalg/linalg_tools.o \ - code/numpy/ndarray/ndarray_iter.o \ - code/numpy/numerical.o \ - code/numpy/numpy.o \ - code/numpy/poly.o \ - code/numpy/stats.o \ - code/numpy/transform.o \ - code/numpy/vector.o \ - code/scipy/linalg/linalg.o \ - code/scipy/optimize/optimize.o \ - code/scipy/scipy.o \ - code/scipy/signal/signal.o \ - code/scipy/special/special.o \ - code/ulab.o \ - code/ulab_tools.o \ - code/user/user.o \ - code/utils/utils.o \ +FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/modules/ulab/code/,\ + ndarray.o \ + ndarray_operators.o \ + ndarray_properties.o \ + numpy/approx.o \ + numpy/bitwise.o \ + numpy/carray/carray.o \ + numpy/carray/carray_tools.o \ + numpy/compare.o \ + numpy/create.o \ + numpy/fft/fft.o \ + numpy/fft/fft_tools.o \ + numpy/filter.o \ + numpy/io/io.o \ + numpy/linalg/linalg.o \ + numpy/linalg/linalg_tools.o \ + numpy/ndarray/ndarray_iter.o \ + numpy/numerical.o \ + numpy/numpy.o \ + numpy/poly.o \ + numpy/random/random.o \ + numpy/stats.o \ + numpy/transform.o \ + numpy/vector.o \ + scipy/linalg/linalg.o \ + scipy/optimize/optimize.o \ + scipy/scipy.o \ + scipy/signal/signal.o \ + scipy/special/special.o \ + ulab.o \ + ulab_tools.o \ + user/user.o \ + utils/utils.o \ ) endif @@ -518,6 +481,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\ extmod/modwebsocket.o \ extmod/modwebrepl.o \ mpnetworkport.o \ + extmod/network_lwip.o \ ) endif @@ -525,7 +489,6 @@ ifeq ($(MICROPY_PY_NETWORK_CYW43), 1) FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\ lib/cyw43-driver/src/*.o \ extmod/network_cyw43.o \ - extmod/network_lwip.o \ ) FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/drivers/,\ cyw43/cywbt.o \ @@ -553,6 +516,40 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\ ) endif +ifeq ($(MICROPY_PY_OPENAMP),1) +FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/openamp/metal/,\ + device.o \ + dma.o \ + init.o \ + io.o \ + irq.o \ + log.o \ + shmem.o \ + softirq.o \ + version.o \ + system/micropython/condition.o \ + system/micropython/device.o \ + system/micropython/io.o \ + system/micropython/irq.o \ + system/micropython/shmem.o \ + system/micropython/time.o \ + ) + +FIRM_OBJ += $(addprefix $(BUILD)/$(MICROPY_DIR)/,\ + mpmetalport.o \ + mpremoteprocport.o \ + lib/open-amp/lib/virtio/virtio.o \ + lib/open-amp/lib/virtio/virtqueue.o \ + lib/open-amp/lib/virtio_mmio/virtio_mmio_drv.o \ + lib/open-amp/lib/rpmsg/rpmsg.o \ + lib/open-amp/lib/rpmsg/rpmsg_virtio.o \ + lib/open-amp/lib/remoteproc/elf_loader.o \ + lib/open-amp/lib/remoteproc/remoteproc.o \ + lib/open-amp/lib/remoteproc/remoteproc_virtio.o \ + lib/open-amp/lib/remoteproc/rsc_table_parser.o \ + ) +endif + #------------- CubeAI Objects -------------------# ifeq ($(CUBEAI), 1) include $(TOP_DIR)/stm32cubeai/cube.mk @@ -648,17 +645,6 @@ UVC_OBJ += $(wildcard $(BUILD)/$(VL53L5CX_DIR)/src/*.o) UVC_OBJ += $(wildcard $(BUILD)/$(PIXART_DIR)/src/*.o) endif -ifeq ($(OMV_ENABLE_CM4), 1) -CM4 = cm4 -# CM4 object files -CM4_OBJ += $(wildcard $(BUILD)/$(CM4_DIR)/src/*.o) -CM4_OBJ += $(wildcard $(BUILD)/$(CM4_DIR)/$(HAL_DIR)/src/*.o) -CM4_OBJ += $(addprefix $(BUILD)/$(CM4_DIR)/$(CMSIS_DIR)/src/, \ - $(STARTUP).o \ - $(SYSTEM).o \ -) -endif - ################################################### #Export Variables export Q @@ -722,10 +708,6 @@ ifeq ($(OMV_ENABLE_UVC), 1) UVC_OBJS: FIRMWARE_OBJS $(MAKE) -C $(UVC_DIR) BUILD=$(BUILD)/$(UVC_DIR) CFLAGS="$(UVC_CFLAGS) -MMD" endif -ifeq ($(OMV_ENABLE_CM4), 1) -CM4_OBJS: FIRMWARE_OBJS - $(MAKE) -C $(CM4_DIR) BUILD=$(BUILD)/$(CM4_DIR) CFLAGS="$(CM4_CFLAGS) -MMD" -endif ifeq ($(OMV_ENABLE_BL), 1) BOOTLOADER_OBJS: FIRMWARE_OBJS $(MAKE) -C $(BOOTLDR_DIR) BUILD=$(BUILD)/$(BOOTLDR_DIR) CFLAGS="$(BL_CFLAGS) -MMD" @@ -759,17 +741,8 @@ $(UVC): FIRMWARE_OBJS UVC_OBJS $(PYTHON) $(MKDFU) -D $(DFU_DEVICE) -b $(MAIN_APP_ADDR):$(FW_DIR)/$(UVC).bin $(FW_DIR)/$(UVC).dfu endif -ifeq ($(OMV_ENABLE_CM4), 1) -# This target generates CM4 firmware for dual core micros. -$(CM4): FIRMWARE_OBJS CM4_OBJS - $(CPP) -P -E -I$(OMV_BOARD_CONFIG_DIR) $(CM4_DIR)/stm32fxxx.ld.S > $(BUILD)/$(CM4_DIR)/stm32fxxx.lds - $(CC) $(CM4_LDFLAGS) $(CM4_OBJ) -o $(FW_DIR)/$(CM4).elf -lgcc - $(OBJCOPY) -Obinary $(FW_DIR)/$(CM4).elf $(FW_DIR)/$(CM4).bin - $(PYTHON) $(MKDFU) -D $(DFU_DEVICE) -b $(M4_APP_ADDR):$(FW_DIR)/$(CM4).bin $(FW_DIR)/$(CM4).dfu -endif - # This target generates the uvc, bootloader and firmware images. -$(OPENMV): $(BOOTLOADER) $(UVC) $(CM4) $(FIRMWARE) +$(OPENMV): $(BOOTLOADER) $(UVC) $(FIRMWARE) ifeq ($(OMV_ENABLE_BL), 1) # Generate a contiguous firmware image for factory programming $(OBJCOPY) -Obinary --pad-to=$(MAIN_APP_ADDR) --gap-fill=0xFF $(FW_DIR)/$(BOOTLOADER).elf $(FW_DIR)/$(BOOTLOADER)_padded.bin diff --git a/src/omv/ports/stm32/stm32fxxx.ld.S b/src/omv/ports/stm32/stm32fxxx.ld.S index cf2082960..8101fc7e4 100755 --- a/src/omv/ports/stm32/stm32fxxx.ld.S +++ b/src/omv/ports/stm32/stm32fxxx.ld.S @@ -44,18 +44,11 @@ MEMORY #if defined(OMV_FLASH_EXT_ORIGIN) FLASH_EXT (rx) : ORIGIN = OMV_FLASH_EXT_ORIGIN, LENGTH = OMV_FLASH_EXT_LENGTH #endif - #if defined(OMV_CM4_RAM_ORIGIN) - CM4_SRAM (xrw) : ORIGIN = OMV_CM4_RAM_ORIGIN, LENGTH = OMV_CM4_RAM_LENGTH - #endif } _ram_start = ORIGIN(OMV_MAIN_MEMORY); _ram_end = ORIGIN(OMV_MAIN_MEMORY) + LENGTH(OMV_MAIN_MEMORY); -#if defined(OMV_CM4_RAM_ORIGIN) -_cm4_ram_start = ORIGIN(CM4_SRAM); -#endif - // Location of filesystem flash storage _micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FFS); _micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FFS) + LENGTH(FLASH_FFS); @@ -113,6 +106,17 @@ SECTIONS _ebss = .; // Define a global symbol at bss end } >OMV_MAIN_MEMORY + /* CM4 boot memory */ + #if defined(OMV_CM4_BOOT_MEMORY) + .cm4_boot_memory (NOLOAD) : ALIGN(4) + { + _cm4_ram_start = .; + . = . + OMV_CM4_BOOT_SIZE; + . = ALIGN(4); + _cm4_ram_start = .; + } >OMV_CM4_BOOT_MEMORY + #endif + #include "common.ld.S" .mp_etext :