Remove code dependency on mp.h header.

This commit is contained in:
iabdalkader 2020-12-18 23:14:01 +02:00
parent 0be13bdaa1
commit 908d5c8291
31 changed files with 134 additions and 96 deletions

View File

@ -6,7 +6,8 @@
* Interface for using extra frame buffer RAM as a stack. * Interface for using extra frame buffer RAM as a stack.
* *
*/ */
#include <mp.h> #include "py/obj.h"
#include "py/nlr.h"
#include "fb_alloc.h" #include "fb_alloc.h"
#include "framebuffer.h" #include "framebuffer.h"
#include "omv_boardconfig.h" #include "omv_boardconfig.h"

View File

@ -8,8 +8,9 @@
* *
* UMM memory allocator. * UMM memory allocator.
*/ */
#include <mp.h>
#include <string.h> #include <string.h>
#include "py/nlr.h"
#include "py/mphal.h"
#include "fb_alloc.h" #include "fb_alloc.h"
#include "umm_malloc.h" #include "umm_malloc.h"
#include "omv_boardconfig.h" #include "omv_boardconfig.h"

View File

@ -8,7 +8,10 @@
* *
* Memory allocation functions. * Memory allocation functions.
*/ */
#include <mp.h> #include <string.h>
#include "py/nlr.h"
#include "py/gc.h"
#include "py/mphal.h"
#include "xalloc.h" #include "xalloc.h"
NORETURN static void xalloc_fail() NORETURN static void xalloc_fail()

View File

@ -8,8 +8,9 @@
* *
* Dynamic array. * Dynamic array.
*/ */
#include <mp.h> #include <string.h>
#include <stackctrl.h> #include "py/runtime.h"
#include "py/stackctrl.h"
#include "xalloc.h" #include "xalloc.h"
#include "array.h" #include "array.h"
#define ARRAY_INIT_SIZE (4) // Size of one GC block. #define ARRAY_INIT_SIZE (4) // Size of one GC block.

View File

@ -6,7 +6,10 @@
* File System Helper Functions * File System Helper Functions
* *
*/ */
#include <mp.h> #include <string.h>
#include "py/runtime.h"
#include "extmod/vfs.h"
#include "extmod/vfs_fat.h"
#include "common.h" #include "common.h"
#include "fb_alloc.h" #include "fb_alloc.h"
#include "ff_wrapper.h" #include "ff_wrapper.h"

View File

@ -8,7 +8,6 @@
* *
* A simple GIF encoder. * A simple GIF encoder.
*/ */
#include <mp.h>
#include "fb_alloc.h" #include "fb_alloc.h"
#include "ff_wrapper.h" #include "ff_wrapper.h"
#include "imlib.h" #include "imlib.h"

View File

@ -9,7 +9,9 @@
* Image library. * Image library.
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <mp.h> #include "py/obj.h"
#include "py/nlr.h"
#include "font.h" #include "font.h"
#include "array.h" #include "array.h"
#include "ff_wrapper.h" #include "ff_wrapper.h"
@ -81,10 +83,10 @@ void point_min_area_rectangle(point_t *corners, point_t *new_corners, int corner
int miny = y0; int miny = y0;
int maxy = y0; int maxy = y0;
for (int j = 0, jj = corners_len - 1; j < jj; j++) { for (int j = 0, jj = corners_len - 1; j < jj; j++) {
minx = MIN(minx, x1[j]); minx = IM_MIN(minx, x1[j]);
maxx = MAX(maxx, x1[j]); maxx = IM_MAX(maxx, x1[j]);
miny = MIN(miny, y1[j]); miny = IM_MIN(miny, y1[j]);
maxy = MAX(maxy, y1[j]); maxy = IM_MAX(maxy, y1[j]);
} }
int area = (maxx - minx + 1) * (maxy - miny + 1); int area = (maxx - minx + 1) * (maxy - miny + 1);

View File

@ -1,36 +0,0 @@
/*
* This file is part of the OpenMV project.
*
* Copyright (c) 2013-2019 Ibrahim Abdelkader <iabdalkader@openmv.io>
* Copyright (c) 2013-2019 Kwabena W. Agyeman <kwagyeman@openmv.io>
*
* This work is licensed under the MIT license, see the file LICENSE for details.
*
* MicroPython header.
*/
#ifndef __MP_H__
#define __MP_H__
#include <stdio.h>
#include <string.h>
#include "mpconfig.h"
#include "misc.h"
#include "systick.h"
#include "pendsv.h"
#include "qstr.h"
#include "misc.h"
#include "nlr.h"
#include "lexer.h"
#include "parse.h"
#include "obj.h"
#include "objtuple.h"
#include "runtime.h"
#include "stream.h"
#include "gc.h"
#include "gccollect.h"
#include "readline.h"
#include "pin.h"
#include "extint.h"
#include "usb.h"
#include "extmod/vfs.h"
#include "extmod/vfs_fat.h"
#endif // __MP_H__

View File

@ -10,7 +10,6 @@
*/ */
#ifndef __PY_ASSERT_H__ #ifndef __PY_ASSERT_H__
#define __PY_ASSERT_H__ #define __PY_ASSERT_H__
#include "mp.h"
#define PY_ASSERT_TRUE(cond) \ #define PY_ASSERT_TRUE(cond) \
do { \ do { \
if ((cond) == 0) { \ if ((cond) == 0) { \

View File

@ -8,7 +8,7 @@
* *
* Clock Python module. * Clock Python module.
*/ */
#include <mp.h> #include "py/obj.h"
#include "systick.h" #include "systick.h"
#include "py_clock.h" #include "py_clock.h"

View File

@ -8,7 +8,9 @@
* *
* GIF Python module. * GIF Python module.
*/ */
#include "mp.h" #include "py/mphal.h"
#include "py/nlr.h"
#include "ff_wrapper.h" #include "ff_wrapper.h"
#include "framebuffer.h" #include "framebuffer.h"
#include "sensor.h" #include "sensor.h"

View File

@ -8,8 +8,11 @@
* *
* Python helper functions. * Python helper functions.
*/ */
#include "py/obj.h"
#include "py/nlr.h"
#include "framebuffer.h" #include "framebuffer.h"
#include "py_helper.h" #include "py_helper.h"
#include "py_assert.h"
extern void *py_image_cobj(mp_obj_t img_obj); extern void *py_image_cobj(mp_obj_t img_obj);

View File

@ -11,7 +11,7 @@
#ifndef __PY_HELPER_H__ #ifndef __PY_HELPER_H__
#define __PY_HELPER_H__ #define __PY_HELPER_H__
#include "imlib.h" #include "imlib.h"
#include "py_assert.h"
extern const mp_obj_fun_builtin_var_t py_func_unavailable_obj; extern const mp_obj_fun_builtin_var_t py_func_unavailable_obj;
image_t *py_helper_arg_to_image_mutable(const mp_obj_t arg); image_t *py_helper_arg_to_image_mutable(const mp_obj_t arg);
image_t *py_helper_arg_to_image_mutable_bayer(const mp_obj_t arg); image_t *py_helper_arg_to_image_mutable_bayer(const mp_obj_t arg);

View File

@ -8,8 +8,19 @@
* *
* Image Python module. * Image Python module.
*/ */
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
#include <arm_math.h> #include <arm_math.h>
#include <mp.h> #include "py/nlr.h"
#include "systick.h"
#include "py/obj.h"
#include "py/objlist.h"
#include "py/objstr.h"
#include "py/objtuple.h"
#include "py/objtype.h"
#include "py/runtime.h"
#include "imlib.h" #include "imlib.h"
#include "array.h" #include "array.h"
#include "sensor.h" #include "sensor.h"
@ -21,8 +32,6 @@
#include "py_helper.h" #include "py_helper.h"
#include "py_image.h" #include "py_image.h"
#include "omv_boardconfig.h" #include "omv_boardconfig.h"
#include "py/runtime0.h"
#include "py/runtime.h"
static const mp_obj_type_t py_cascade_type; static const mp_obj_type_t py_cascade_type;
static const mp_obj_type_t py_image_type; static const mp_obj_type_t py_image_type;

View File

@ -10,7 +10,6 @@
*/ */
#ifndef __PY_IMAGE_H__ #ifndef __PY_IMAGE_H__
#define __PY_IMAGE_H__ #define __PY_IMAGE_H__
// DISABLED #include <mp.h>
#include "imlib.h" #include "imlib.h"
mp_obj_t py_image(int width, int height, int bpp, void *pixels); mp_obj_t py_image(int width, int height, int bpp, void *pixels);
mp_obj_t py_image_from_struct(image_t *img); mp_obj_t py_image_from_struct(image_t *img);

View File

@ -8,7 +8,8 @@
* *
* MJPEG Python module. * MJPEG Python module.
*/ */
#include "mp.h" #include "py/obj.h"
#include "py/nlr.h"
#include "ff_wrapper.h" #include "ff_wrapper.h"
#include "framebuffer.h" #include "framebuffer.h"
#include "sensor.h" #include "sensor.h"

View File

@ -8,7 +8,10 @@
* *
* OMV Python module. * OMV Python module.
*/ */
#include <mp.h> #include <string.h>
#include <stdio.h>
#include <stdbool.h>
#include "py/obj.h"
#include "usbdbg.h" #include "usbdbg.h"
#include "framebuffer.h" #include "framebuffer.h"
#include "omv_boardconfig.h" #include "omv_boardconfig.h"

View File

@ -9,7 +9,8 @@
* Sensor Python module. * Sensor Python module.
*/ */
#include <stdarg.h> #include <stdarg.h>
#include "mp.h" #include "py/mphal.h"
#include "py/nlr.h"
#include "pin.h" #include "pin.h"
#include "sensor.h" #include "sensor.h"
#include "imlib.h" #include "imlib.h"

View File

@ -3,8 +3,14 @@
* This work is licensed under the MIT license, see the file LICENSE for details. * This work is licensed under the MIT license, see the file LICENSE for details.
*/ */
#include <mp.h> #include "py/obj.h"
#include "py/nlr.h"
#include "py/obj.h"
#include "py/objlist.h"
#include "py/objtuple.h"
#include "py_helper.h" #include "py_helper.h"
#include "py_assert.h"
#include "py_image.h" #include "py_image.h"
#include "ff_wrapper.h" #include "ff_wrapper.h"
#include "libtf.h" #include "libtf.h"

View File

@ -8,17 +8,22 @@
* *
* Audio Python module. * Audio Python module.
*/ */
#include <mp.h> #include <stdio.h>
#include "py_audio.h" #include "py/obj.h"
#include "py/objarray.h"
#include "py/nlr.h"
#include "py/mphal.h"
#include "py/binary.h"
#include "systick.h" #include "systick.h"
#include "pendsv.h"
#include "runtime.h"
#include "py_audio.h"
#include "py_assert.h" #include "py_assert.h"
#include "py_helper.h" #include "py_helper.h"
#include "py/binary.h"
#include "pdm2pcm_glo.h" #include "pdm2pcm_glo.h"
#include "fb_alloc.h" #include "fb_alloc.h"
#include "omv_boardconfig.h" #include "omv_boardconfig.h"
#include "py/obj.h"
#include "py/objarray.h"
#include "common.h" #include "common.h"
#if MICROPY_PY_AUDIO #if MICROPY_PY_AUDIO

View File

@ -10,12 +10,14 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <mp.h>
#include <math.h> #include <math.h>
#include STM32_HAL_H #include "py/obj.h"
#include "py/nlr.h"
#include "py_cpufreq.h" #include "py_cpufreq.h"
#include "py_helper.h" #include "py_helper.h"
#include "omv_boardconfig.h" #include "omv_boardconfig.h"
#include STM32_HAL_H
#if defined(STM32F7) || defined(STM32H7) #if defined(STM32F7) || defined(STM32H7)

View File

@ -9,6 +9,12 @@
* FIR Python module. * FIR Python module.
*/ */
#include <stdbool.h> #include <stdbool.h>
#include "py/obj.h"
#include "py/nlr.h"
#include "py/gc.h"
#include "py/mphal.h"
#include "systick.h"
#include "soft_i2c.h" #include "soft_i2c.h"
#include "cambus.h" #include "cambus.h"
#include "MLX90640_I2C_Driver.h" #include "MLX90640_I2C_Driver.h"
@ -17,6 +23,7 @@
#include "framebuffer.h" #include "framebuffer.h"
#include "sensor.h" #include "sensor.h"
#include "py_helper.h" #include "py_helper.h"
#include "py_assert.h"
#include "py_image.h" #include "py_image.h"
#include "py_fir.h" #include "py_fir.h"

View File

@ -8,11 +8,16 @@
* *
* IMU Python module. * IMU Python module.
*/ */
#include STM32_HAL_H #include "py/obj.h"
#include "py/nlr.h"
#include "py/mphal.h"
#include "systick.h"
#include "lsm6ds3tr_c_reg.h" #include "lsm6ds3tr_c_reg.h"
#include "omv_boardconfig.h" #include "omv_boardconfig.h"
#include "py_helper.h" #include "py_helper.h"
#include "py_imu.h" #include "py_imu.h"
#include STM32_HAL_H
#if MICROPY_PY_IMU #if MICROPY_PY_IMU

View File

@ -8,7 +8,9 @@
* *
* LCD Python module. * LCD Python module.
*/ */
#include STM32_HAL_H #include "py/obj.h"
#include "py/nlr.h"
#include "extint.h" #include "extint.h"
#include "spi.h" #include "spi.h"
#include "py_lcd_cec.h" #include "py_lcd_cec.h"
@ -16,6 +18,7 @@
#include "py_helper.h" #include "py_helper.h"
#include "extmod/machine_i2c.h" #include "extmod/machine_i2c.h"
#include "omv_boardconfig.h" #include "omv_boardconfig.h"
#include STM32_HAL_H
#define FRAMEBUFFER_COUNT 3 #define FRAMEBUFFER_COUNT 3
static int framebuffer_head = 0; static int framebuffer_head = 0;

View File

@ -8,15 +8,18 @@
* *
* Micro Speech Python module. * Micro Speech Python module.
*/ */
#include <mp.h> #include <stdio.h>
#include "systick.h"
#include "py_assert.h"
#include "py_helper.h"
#include "py/binary.h"
#include "fb_alloc.h"
#include "omv_boardconfig.h"
#include "py/obj.h" #include "py/obj.h"
#include "py/objarray.h" #include "py/objarray.h"
#include "py/nlr.h"
#include "py/mphal.h"
#include "systick.h"
#include "py/binary.h"
#include "py_assert.h"
#include "py_helper.h"
#include "fb_alloc.h"
#include "omv_boardconfig.h"
#include "libtf.h" #include "libtf.h"
#include "py_tf.h" #include "py_tf.h"
#include "common.h" #include "common.h"

View File

@ -6,10 +6,13 @@
* TV Python module. * TV Python module.
* *
*/ */
#include <mp.h> #include "py/nlr.h"
#include <objstr.h> #include "py/mphal.h"
#include "systick.h"
#include "py/obj.h"
#include "py/objstr.h"
#include <spi.h> #include <spi.h>
#include <systick.h>
#include "imlib.h" #include "imlib.h"
#include "fb_alloc.h" #include "fb_alloc.h"
#include "ff_wrapper.h" #include "ff_wrapper.h"

View File

@ -8,9 +8,10 @@
* *
* Sensor abstraction layer. * Sensor abstraction layer.
*/ */
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "mp.h" #include <stdint.h>
#include <stdbool.h>
#include "py/mphal.h"
#include "irq.h" #include "irq.h"
#include "cambus.h" #include "cambus.h"
#include "ov2640.h" #include "ov2640.h"

View File

@ -8,7 +8,11 @@
* *
* Software I2C implementation. * Software I2C implementation.
*/ */
#include <mp.h> #include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include "py/mphal.h"
#include "soft_i2c.h" #include "soft_i2c.h"
#include "omv_boardconfig.h" #include "omv_boardconfig.h"

View File

@ -8,18 +8,24 @@
* *
* USB debugger. * USB debugger.
*/ */
#include "mp.h" #include <string.h>
#include <stdio.h>
#include "py/nlr.h"
#include "py/gc.h"
#include "py/mphal.h"
#include "py/obj.h"
#include "py/lexer.h"
#include "py/parse.h"
#include "py/compile.h"
#include "py/runtime.h"
#include "pendsv.h"
#include "imlib.h" #include "imlib.h"
#include "sensor.h" #include "sensor.h"
#include "framebuffer.h" #include "framebuffer.h"
#include "ff.h" #include "ff.h"
#include "usb.h" #include "usb.h"
#include "usbdbg.h" #include "usbdbg.h"
#include "nlr.h"
#include "lexer.h"
#include "parse.h"
#include "compile.h"
#include "runtime.h"
#include "omv_boardconfig.h" #include "omv_boardconfig.h"
#if MICROPY_HW_USB_HS #if MICROPY_HW_USB_HS

View File

@ -12,16 +12,19 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <errno.h> #include <errno.h>
#include "py/nlr.h"
#include "py/mphal.h"
#include "py/obj.h"
#include "py/lexer.h"
#include "py/parse.h"
#include "py/compile.h"
#include "py/runtime.h"
#include "py/stackctrl.h"
#include "irq.h"
#include "winc.h" #include "winc.h"
#include "socket/include/socket.h" #include "socket/include/socket.h"
#include "driver/include/m2m_wifi.h" #include "driver/include/m2m_wifi.h"
#include "mp.h"
#include "irq.h"
#include "lexer.h"
#include "parse.h"
#include "compile.h"
#include "runtime.h"
#include "stackctrl.h"
#include "usbdbg.h" #include "usbdbg.h"
#include "sensor.h" #include "sensor.h"
#include "framebuffer.h" #include "framebuffer.h"

View File

@ -9,7 +9,6 @@
* Lepton driver. * Lepton driver.
*/ */
#include STM32_HAL_H #include STM32_HAL_H
#include "mp.h"
#include "irq.h" #include "irq.h"
#include "cambus.h" #include "cambus.h"
#include "sensor.h" #include "sensor.h"