mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Merge pull request #2245 from openmv/micropython_1_23
micropython: Update to Micropython v1.23.0.
This commit is contained in:
commit
e65c4ff711
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,60 +0,0 @@
|
||||
# This file is part of the OpenMV project.
|
||||
#
|
||||
# Copyright (c) 2013-2021 Ibrahim Abdelkader <iabdalkader@openmv.io>
|
||||
# Copyright (c) 2013-2021 Kwabena W. Agyeman <kwagyeman@openmv.io>
|
||||
#
|
||||
# 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)
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* 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****/
|
||||
@ -1,102 +0,0 @@
|
||||
/*
|
||||
* This file is part of the OpenMV project.
|
||||
*
|
||||
* Copyright (c) 2013-2021 Ibrahim Abdelkader <iabdalkader@openmv.io>
|
||||
* Copyright (c) 2013-2021 Kwabena W. Agyeman <kwagyeman@openmv.io>
|
||||
*
|
||||
* 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) }
|
||||
}
|
||||
@ -1 +1 @@
|
||||
Subproject commit fff2e1fb525cd8f92aadecbd9901abada1e891d1
|
||||
Subproject commit 6f4277b26d3d5f69001d64eaa6b0fcc47e527d1e
|
||||
@ -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
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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__
|
||||
|
||||
@ -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__
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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__
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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__
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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__
|
||||
|
||||
@ -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__
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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__
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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__
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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__
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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__
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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__
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
include("$(MPY_DIR)/extmod/asyncio")
|
||||
|
||||
# Networking
|
||||
require("ssl")
|
||||
require("ntptime")
|
||||
require("webrepl")
|
||||
|
||||
|
||||
@ -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__
|
||||
|
||||
@ -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) :
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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 = {
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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 },
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -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,
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit ac2e9954edc185ec212e437e73e4b5e4290de35b
|
||||
Subproject commit 65c941a8059afe1cfd6f4c2b15d0ade798dc24f2
|
||||
@ -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
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
#include <mpconfigport.h>
|
||||
|
||||
#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
|
||||
|
||||
@ -36,8 +36,8 @@ CFLAGS += -DCPU_$(MCU_VARIANT) \
|
||||
-DCLOCK_CONFIG_H='<boards/$(MCU_SERIES)_clock_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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 :
|
||||
|
||||
Loading…
Reference in New Issue
Block a user