misc: Replace deprecated STATIC with static.

This commit is contained in:
iabdalkader 2024-07-01 10:17:21 +02:00
parent 4488f778f5
commit f57c2f5e56
27 changed files with 720 additions and 720 deletions

View File

@ -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 = {

View File

@ -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,

View File

@ -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 },

View File

@ -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) {
@ -219,7 +219,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 +236,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

View File

@ -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 },

View File

@ -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;

View File

@ -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 };
@ -242,7 +242,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 +266,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 +276,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 },

View File

@ -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 };
@ -125,9 +125,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 +140,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 +150,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

View File

@ -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,9 +472,9 @@ 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;
@ -580,7 +580,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 +603,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,

View File

@ -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 } },
@ -183,9 +183,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 +199,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 +209,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 },

View File

@ -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) {
@ -459,23 +459,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 +487,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 +497,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 },

View File

@ -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,

View File

@ -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 },

View File

@ -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 },

View File

@ -407,7 +407,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,

View File

@ -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 };
@ -123,7 +123,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 +135,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 +153,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 },

View File

@ -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 },

View File

@ -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 },

View File

@ -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) {

View File

@ -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 },

View File

@ -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 },

View File

@ -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 },

View File

@ -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 },

View File

@ -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 },

View File

@ -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,

View File

@ -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,