From 0190cae381aebdf1b91a2d76439f8e03dfc021a9 Mon Sep 17 00:00:00 2001 From: enriquezgarc Date: Mon, 11 Mar 2024 10:21:53 +0100 Subject: [PATCH] ports/psoc6: Replaced deprecated STATIC macro. Signed-off-by: enriquezgarc --- ports/psoc6/boards/make-pins.py | 2 +- ports/psoc6/machine_adc.c | 24 +++++++------- ports/psoc6/machine_adcblock.c | 16 +++++----- ports/psoc6/machine_i2c.c | 40 +++++++++++------------ ports/psoc6/machine_i2s.c | 38 +++++++++++----------- ports/psoc6/machine_pin.c | 40 +++++++++++------------ ports/psoc6/machine_pwm.c | 34 ++++++++++---------- ports/psoc6/machine_rtc.c | 26 +++++++-------- ports/psoc6/machine_spi.c | 24 +++++++------- ports/psoc6/machine_timer.c | 18 +++++------ ports/psoc6/modmachine.c | 38 +++++++++++----------- ports/psoc6/modos.c | 20 ++++++------ ports/psoc6/modpsoc6.c | 4 +-- ports/psoc6/modtime.c | 4 +-- ports/psoc6/network_ifx_wcm.c | 56 ++++++++++++++++----------------- ports/psoc6/psoc6_flash.c | 20 ++++++------ ports/psoc6/psoc6_qspi_flash.c | 20 ++++++------ 17 files changed, 212 insertions(+), 212 deletions(-) diff --git a/ports/psoc6/boards/make-pins.py b/ports/psoc6/boards/make-pins.py index 75b1b1d5846d4..74dfc7a5652ca 100755 --- a/ports/psoc6/boards/make-pins.py +++ b/ports/psoc6/boards/make-pins.py @@ -130,7 +130,7 @@ def parse_board_file(self): def print_named(self, label, named_pins): print( - "STATIC const mp_rom_map_elem_t pin_{:s}_pins_locals_dict_table[] = {{".format(label) + "static const mp_rom_map_elem_t pin_{:s}_pins_locals_dict_table[] = {{".format(label) ) num_cpu_pins = 0 for named_pin in named_pins: diff --git a/ports/psoc6/machine_adc.c b/ports/psoc6/machine_adc.c index 8675f9b8c5022..abbcce548e3e0 100644 --- a/ports/psoc6/machine_adc.c +++ b/ports/psoc6/machine_adc.c @@ -70,13 +70,13 @@ uint8_t adc_get_resolution(machine_adc_obj_t *adc) { } // machine_adc_print() -STATIC void machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +static void machine_adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_printf(print, "", self->pin_phy->addr, self->block->id, self->sample_ns); } // ADC(id) -STATIC mp_obj_t machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { +static mp_obj_t machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { // Check number of arguments mp_arg_check_num(n_args, n_kw, 1, 6, true); enum {ARG_sample_ns}; @@ -99,46 +99,46 @@ STATIC mp_obj_t machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, s } // deinit() -STATIC mp_obj_t machine_adc_deinit(mp_obj_t self_in) { +static mp_obj_t machine_adc_deinit(mp_obj_t self_in) { machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in); adc_obj_deinit(self); adc_block_channel_free(self->block, self); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_deinit_obj, machine_adc_deinit); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_deinit_obj, machine_adc_deinit); // block() -STATIC mp_obj_t machine_adc_block(mp_obj_t self_in) { +static mp_obj_t machine_adc_block(mp_obj_t self_in) { const machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_FROM_PTR(self->block); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_block_obj, machine_adc_block); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_block_obj, machine_adc_block); // read_u16() -STATIC mp_obj_t machine_adc_read_u16(mp_obj_t self_in) { +static mp_obj_t machine_adc_read_u16(mp_obj_t self_in) { machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in); int32_t adc_raw_result = cyhal_adc_read(&(self->adc_chan_obj)); mp_int_t bits = (mp_int_t)adc_get_resolution(self); mp_uint_t u16 = adc_raw_result << (16 - bits); return MP_OBJ_NEW_SMALL_INT(u16); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_read_u16_obj, machine_adc_read_u16); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_read_u16_obj, machine_adc_read_u16); // read_uv -STATIC mp_obj_t machine_adc_read_uv(mp_obj_t self_in) { +static mp_obj_t machine_adc_read_uv(mp_obj_t self_in) { machine_adc_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_NEW_SMALL_INT(cyhal_adc_read_uv(&(self->adc_chan_obj))); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_read_uv_obj, machine_adc_read_uv); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_adc_read_uv_obj, machine_adc_read_uv); -STATIC const mp_rom_map_elem_t machine_adc_locals_dict_table[] = { +static const mp_rom_map_elem_t machine_adc_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_adc_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR_read_u16), MP_ROM_PTR(&machine_adc_read_u16_obj) }, { MP_ROM_QSTR(MP_QSTR_read_uv), MP_ROM_PTR(&machine_adc_read_uv_obj) }, { MP_ROM_QSTR(MP_QSTR_block), MP_ROM_PTR(&machine_adc_block_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(machine_adc_locals_dict, machine_adc_locals_dict_table); +static MP_DEFINE_CONST_DICT(machine_adc_locals_dict, machine_adc_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( machine_adc_type, diff --git a/ports/psoc6/machine_adcblock.c b/ports/psoc6/machine_adcblock.c index e05c54e725224..e9ebfb6e42c79 100644 --- a/ports/psoc6/machine_adcblock.c +++ b/ports/psoc6/machine_adcblock.c @@ -220,13 +220,13 @@ machine_adc_obj_t *adc_block_channel_find(machine_adcblock_obj_t *adc_block, mp_ } // machine_adcblock_print() -STATIC void machine_adcblock_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +static void machine_adcblock_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { machine_adcblock_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_printf(print, "ADCBlock(%u, bits=%u)", self->id, self->bits); } // ADCBlock constructor -STATIC mp_obj_t machine_adcblock_make_new(const mp_obj_type_t *type, size_t n_pos_args, size_t n_kw_args, const mp_obj_t *all_args) { +static mp_obj_t machine_adcblock_make_new(const mp_obj_type_t *type, size_t n_pos_args, size_t n_kw_args, const mp_obj_t *all_args) { mp_arg_check_num(n_pos_args, n_kw_args, 1, MP_OBJ_FUN_ARGS_MAX, true); mp_map_t kw_args; @@ -251,16 +251,16 @@ STATIC mp_obj_t machine_adcblock_make_new(const mp_obj_type_t *type, size_t n_po } // ADCBlock deinit() -STATIC mp_obj_t machine_adcblock_deinit(mp_obj_t self_in) { +static mp_obj_t machine_adcblock_deinit(mp_obj_t self_in) { machine_adcblock_obj_t *self = MP_OBJ_TO_PTR(self_in); _adc_block_obj_deinit(self); _adc_block_obj_free(self); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_adcblock_deinit_obj, machine_adcblock_deinit); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_adcblock_deinit_obj, machine_adcblock_deinit); // ADCBlock connect() -STATIC mp_obj_t machine_adcblock_connect(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t machine_adcblock_connect(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { machine_adcblock_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); uint8_t channel = -1; uint32_t pin = 0; @@ -296,13 +296,13 @@ STATIC mp_obj_t machine_adcblock_connect(size_t n_pos_args, const mp_obj_t *pos_ return adc; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_adcblock_connect_obj, 2, machine_adcblock_connect); +static MP_DEFINE_CONST_FUN_OBJ_KW(machine_adcblock_connect_obj, 2, machine_adcblock_connect); -STATIC const mp_rom_map_elem_t machine_adcblock_locals_dict_table[] = { +static const mp_rom_map_elem_t machine_adcblock_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_adcblock_deinit_obj)}, { MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&machine_adcblock_connect_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(machine_adcblock_locals_dict, machine_adcblock_locals_dict_table); +static MP_DEFINE_CONST_DICT(machine_adcblock_locals_dict, machine_adcblock_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( machine_adcblock_type, diff --git a/ports/psoc6/machine_i2c.c b/ports/psoc6/machine_i2c.c index 05d39a0058a6d..7a2ebf89f886b 100644 --- a/ports/psoc6/machine_i2c.c +++ b/ports/psoc6/machine_i2c.c @@ -65,7 +65,7 @@ static inline void i2c_obj_free(machine_i2c_obj_t *i2c_obj_ptr) { } } -STATIC void i2c_init(machine_i2c_obj_t *machine_i2c_obj, uint32_t freq_hz, int16_t slave_addr) { +static void i2c_init(machine_i2c_obj_t *machine_i2c_obj, uint32_t freq_hz, int16_t slave_addr) { // Define the I2C master configuration structure // Set cgf frequency @@ -88,7 +88,7 @@ STATIC void i2c_init(machine_i2c_obj_t *machine_i2c_obj, uint32_t freq_hz, int16 i2c_assert_raise_val("I2C initialisation failed with return code %lx !", result); } -STATIC inline void i2c_sda_alloc(machine_i2c_obj_t *i2c_obj, mp_obj_t pin_name) { +static inline void i2c_sda_alloc(machine_i2c_obj_t *i2c_obj, mp_obj_t pin_name) { machine_pin_phy_obj_t *sda = pin_phy_realloc(pin_name, PIN_PHY_FUNC_I2C); if (sda == NULL) { @@ -99,11 +99,11 @@ STATIC inline void i2c_sda_alloc(machine_i2c_obj_t *i2c_obj, mp_obj_t pin_name) i2c_obj->sda = sda; } -STATIC inline void i2c_sda_free(machine_i2c_obj_t *i2c_obj) { +static inline void i2c_sda_free(machine_i2c_obj_t *i2c_obj) { pin_phy_free(i2c_obj->sda); } -STATIC inline void i2c_scl_alloc(machine_i2c_obj_t *i2c_obj, mp_obj_t pin_name) { +static inline void i2c_scl_alloc(machine_i2c_obj_t *i2c_obj, mp_obj_t pin_name) { machine_pin_phy_obj_t *scl = pin_phy_realloc(pin_name, PIN_PHY_FUNC_I2C); if (scl == NULL) { @@ -114,11 +114,11 @@ STATIC inline void i2c_scl_alloc(machine_i2c_obj_t *i2c_obj, mp_obj_t pin_name) i2c_obj->scl = scl; } -STATIC inline void i2c_scl_free(machine_i2c_obj_t *i2c_obj) { +static inline void i2c_scl_free(machine_i2c_obj_t *i2c_obj) { pin_phy_free(i2c_obj->scl); } -STATIC void machine_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +static void machine_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { machine_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_printf(print, "I2C(freq=%u, scl=%u, sda=%u, mode=%u, addr=%u)", self->cfg.frequencyhal_hz, self->scl->addr, self->sda->addr, self->cfg.is_slave, self->cfg.address); } @@ -184,7 +184,7 @@ mp_obj_t machine_i2c_slave_make_new(const mp_obj_type_t *type, size_t n_args, si return MP_OBJ_FROM_PTR(self); } -STATIC void machine_i2c_deinit(mp_obj_base_t *self_in) { +static void machine_i2c_deinit(mp_obj_base_t *self_in) { machine_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); cyhal_i2c_free(&(self->i2c_obj)); i2c_sda_free(self); @@ -192,7 +192,7 @@ STATIC void machine_i2c_deinit(mp_obj_base_t *self_in) { i2c_obj_free(self); } -STATIC int machine_i2c_transfer(mp_obj_base_t *self_in, uint16_t addr, size_t len, uint8_t *buf, unsigned int flags) { +static int machine_i2c_transfer(mp_obj_base_t *self_in, uint16_t addr, size_t len, uint8_t *buf, unsigned int flags) { machine_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); cy_rslt_t result = CY_RSLT_SUCCESS; bool send_stop = (flags & MP_MACHINE_I2C_FLAG_STOP) ? true : false; @@ -228,7 +228,7 @@ STATIC int machine_i2c_transfer(mp_obj_base_t *self_in, uint16_t addr, size_t le } } -STATIC const mp_machine_i2c_p_t machine_i2c_p = { +static const mp_machine_i2c_p_t machine_i2c_p = { .deinit = machine_i2c_deinit, .transfer_single = machine_i2c_transfer, .transfer = mp_machine_i2c_transfer_adaptor @@ -246,14 +246,14 @@ MP_DEFINE_CONST_OBJ_TYPE( #if MICROPY_PY_MACHINE_I2C_SLAVE -STATIC mp_obj_t machine_i2c_slave_deinit(mp_obj_t self_in) { +static mp_obj_t machine_i2c_slave_deinit(mp_obj_t self_in) { mp_obj_base_t *self = MP_OBJ_TO_PTR(self_in); machine_i2c_deinit(self); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_1(machine_i2c_slave_deinit_obj, machine_i2c_slave_deinit); -STATIC mp_obj_t machine_i2c_slave_configure_receive_buffer(mp_obj_t self_in, mp_obj_t buf_in) { +static mp_obj_t machine_i2c_slave_configure_receive_buffer(mp_obj_t self_in, mp_obj_t buf_in) { machine_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_buffer_info_t bufinfo; mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); @@ -263,9 +263,9 @@ STATIC mp_obj_t machine_i2c_slave_configure_receive_buffer(mp_obj_t self_in, mp_ return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_i2c_slave_conf_rx_buffer_obj, machine_i2c_slave_configure_receive_buffer); +static MP_DEFINE_CONST_FUN_OBJ_2(machine_i2c_slave_conf_rx_buffer_obj, machine_i2c_slave_configure_receive_buffer); -STATIC mp_obj_t machine_i2c_slave_configure_transmit_buffer(mp_obj_t self_in, mp_obj_t buf_in) { +static mp_obj_t machine_i2c_slave_configure_transmit_buffer(mp_obj_t self_in, mp_obj_t buf_in) { machine_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_buffer_info_t bufinfo; mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); @@ -275,14 +275,14 @@ STATIC mp_obj_t machine_i2c_slave_configure_transmit_buffer(mp_obj_t self_in, mp return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_i2c_slave_conf_tx_buffer_obj, machine_i2c_slave_configure_transmit_buffer); +static MP_DEFINE_CONST_FUN_OBJ_2(machine_i2c_slave_conf_tx_buffer_obj, machine_i2c_slave_configure_transmit_buffer); static void i2c_irq_handler(void *callback_arg, cyhal_i2c_event_t event) { machine_i2c_obj_t *self = callback_arg; mp_sched_schedule(self->callback, mp_obj_new_int(event)); } -STATIC mp_obj_t machine_i2c_slave_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t machine_i2c_slave_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_callback, ARG_events, ARG_priority}; static const mp_arg_t allowed_args[] = { { MP_QSTR_callback, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} }, @@ -301,16 +301,16 @@ STATIC mp_obj_t machine_i2c_slave_irq(size_t n_args, const mp_obj_t *pos_args, m return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2c_slave_irq_obj, 1, machine_i2c_slave_irq); +static MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2c_slave_irq_obj, 1, machine_i2c_slave_irq); -STATIC mp_obj_t machine_i2c_slave_irq_disable(mp_obj_t self_in) { +static mp_obj_t machine_i2c_slave_irq_disable(mp_obj_t self_in) { machine_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); cyhal_i2c_enable_event(&self->i2c_obj, CYHAL_I2C_EVENT_NONE, 3, false); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_i2c_slave_irq_disable_obj, machine_i2c_slave_irq_disable); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_i2c_slave_irq_disable_obj, machine_i2c_slave_irq_disable); -STATIC const mp_rom_map_elem_t machine_i2c_slave_locals_dict_table[] = { +static const mp_rom_map_elem_t machine_i2c_slave_locals_dict_table[] = { // Functions { MP_ROM_QSTR(MP_QSTR_conf_receive_buffer), MP_ROM_PTR(&machine_i2c_slave_conf_rx_buffer_obj) }, { MP_ROM_QSTR(MP_QSTR_conf_transmit_buffer), MP_ROM_PTR(&machine_i2c_slave_conf_tx_buffer_obj) }, @@ -327,7 +327,7 @@ STATIC const mp_rom_map_elem_t machine_i2c_slave_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_WR_CMPLT_EVENT), MP_ROM_INT(CYHAL_I2C_SLAVE_WR_CMPLT_EVENT) }, { MP_ROM_QSTR(MP_QSTR_ERR_EVENT), MP_ROM_INT(CYHAL_I2C_SLAVE_ERR_EVENT) }, }; -STATIC MP_DEFINE_CONST_DICT(machine_i2c_slave_locals_dict, machine_i2c_slave_locals_dict_table); +static MP_DEFINE_CONST_DICT(machine_i2c_slave_locals_dict, machine_i2c_slave_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( machine_i2c_slave_type, diff --git a/ports/psoc6/machine_i2s.c b/ports/psoc6/machine_i2s.c index f8fc802567801..56506bb10b64f 100644 --- a/ports/psoc6/machine_i2s.c +++ b/ports/psoc6/machine_i2s.c @@ -79,7 +79,7 @@ typedef struct _machine_i2s_obj_t { } machine_i2s_obj_t; -STATIC void machine_i2s_init_helper(machine_i2s_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static void machine_i2s_init_helper(machine_i2s_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_sck, @@ -191,14 +191,14 @@ STATIC void machine_i2s_init_helper(machine_i2s_obj_t *self, size_t n_pos_args, } -STATIC mp_obj_t machine_i2s_deinit(mp_obj_t self_in) { +static mp_obj_t machine_i2s_deinit(mp_obj_t self_in) { machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in); cyhal_i2s_free(&self->i2s_obj); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_i2s_deinit_obj, machine_i2s_deinit); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_i2s_deinit_obj, machine_i2s_deinit); -STATIC machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) { +static machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) { machine_i2s_obj_t *self; if (MP_STATE_PORT(machine_i2s_obj[i2s_id]) == NULL) { @@ -214,7 +214,7 @@ STATIC machine_i2s_obj_t *mp_machine_i2s_make_new_instance(mp_int_t i2s_id) { } -STATIC void machine_i2s_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +static void machine_i2s_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_printf(print, "I2S(id=%u,\n" "sck="MP_HAL_PIN_FMT ",\n" @@ -233,7 +233,7 @@ STATIC void machine_i2s_print(const mp_print_t *print, mp_obj_t self_in, mp_prin ); } -STATIC mp_obj_t machine_i2s_make_new(const mp_obj_type_t *type, size_t n_pos_args, size_t n_kw_args, const mp_obj_t *args) { +static mp_obj_t machine_i2s_make_new(const mp_obj_type_t *type, size_t n_pos_args, size_t n_kw_args, const mp_obj_t *args) { mp_arg_check_num(n_pos_args, n_kw_args, 1, MP_OBJ_FUN_ARGS_MAX, true); mp_int_t i2s_id = mp_obj_get_int(args[0]); @@ -250,16 +250,16 @@ STATIC mp_obj_t machine_i2s_make_new(const mp_obj_type_t *type, size_t n_pos_arg return MP_OBJ_FROM_PTR(self); } -STATIC mp_obj_t machine_i2s_init(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t machine_i2s_init(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { machine_i2s_obj_t *self = pos_args[0]; machine_i2s_deinit(self); machine_i2s_init_helper(self, n_pos_args - 1, pos_args + 1, kw_args); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2s_init_obj, 1, machine_i2s_init); +static MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2s_init_obj, 1, machine_i2s_init); // placeholder function not complete -STATIC mp_obj_t machine_i2s_irq(mp_obj_t self_in, mp_obj_t handler) { +static mp_obj_t machine_i2s_irq(mp_obj_t self_in, mp_obj_t handler) { machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in); if (handler != mp_const_none && !mp_obj_is_callable(handler)) { mp_raise_ValueError(MP_ERROR_TEXT("invalid callback")); @@ -276,9 +276,9 @@ STATIC mp_obj_t machine_i2s_irq(mp_obj_t self_in, mp_obj_t handler) { self->callback_for_non_blocking = handler; return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_i2s_irq_obj, machine_i2s_irq); +static MP_DEFINE_CONST_FUN_OBJ_2(machine_i2s_irq_obj, machine_i2s_irq); -STATIC mp_obj_t machine_i2s_stop(mp_obj_t self_in) { +static mp_obj_t machine_i2s_stop(mp_obj_t self_in) { machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in); if (self->mode == TX) { cyhal_i2s_stop_tx(&self->i2s_obj); @@ -287,12 +287,12 @@ STATIC mp_obj_t machine_i2s_stop(mp_obj_t self_in) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_i2s_stop_obj, machine_i2s_stop); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_i2s_stop_obj, machine_i2s_stop); // Shift() is typically used as a volume control. // shift=1 increases volume by 6dB, shift=-1 decreases volume by 6dB -STATIC mp_obj_t machine_i2s_shift(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t machine_i2s_shift(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buf, ARG_bits, ARG_shift}; static const mp_arg_t allowed_args[] = { // { MP_QSTR_buf, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, @@ -349,8 +349,8 @@ STATIC mp_obj_t machine_i2s_shift(size_t n_args, const mp_obj_t *pos_args, mp_ma return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2s_shift_fun_obj, 0, machine_i2s_shift); -STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(machine_i2s_shift_obj, MP_ROM_PTR(&machine_i2s_shift_fun_obj)); +static MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2s_shift_fun_obj, 0, machine_i2s_shift); +static MP_DEFINE_CONST_STATICMETHOD_OBJ(machine_i2s_shift_obj, MP_ROM_PTR(&machine_i2s_shift_fun_obj)); void clock_init(void) { cyhal_clock_t clock_pll; @@ -406,7 +406,7 @@ void clock_init(void) { } -STATIC const mp_rom_map_elem_t machine_i2s_locals_dict_table[] = { +static const mp_rom_map_elem_t machine_i2s_locals_dict_table[] = { // Methods { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_i2s_init_obj) }, { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) }, @@ -428,7 +428,7 @@ MP_DEFINE_CONST_DICT(machine_i2s_locals_dict, machine_i2s_locals_dict_table); -STATIC mp_uint_t machine_i2s_stream_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) { +static mp_uint_t machine_i2s_stream_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) { machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in); cy_rslt_t result; @@ -476,7 +476,7 @@ STATIC mp_uint_t machine_i2s_stream_read(mp_obj_t self_in, void *buf_in, mp_uint } -STATIC mp_uint_t machine_i2s_stream_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) { +static mp_uint_t machine_i2s_stream_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) { machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in); cy_rslt_t result; @@ -516,7 +516,7 @@ STATIC mp_uint_t machine_i2s_stream_write(mp_obj_t self_in, const void *buf_in, } -STATIC const mp_stream_p_t i2s_stream_p = { +static const mp_stream_p_t i2s_stream_p = { .read = machine_i2s_stream_read, .write = machine_i2s_stream_write, .ioctl = false, diff --git a/ports/psoc6/machine_pin.c b/ports/psoc6/machine_pin.c index d96a41004bcf5..c737a5faaba75 100644 --- a/ports/psoc6/machine_pin.c +++ b/ports/psoc6/machine_pin.c @@ -59,7 +59,7 @@ static inline void pin_io_free(machine_pin_io_obj_t *pin) { } // Pin.print() -STATIC void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +static void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { mplogger_print("machine pin print\n"); machine_pin_io_obj_t *self = self_in; @@ -208,7 +208,7 @@ static bool machine_pin_is_inited(machine_pin_io_obj_t *self) { } // helper function to parse given initial params and invoke HAL-level GPIO functions -STATIC mp_obj_t machine_pin_obj_init_helper(machine_pin_io_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t machine_pin_obj_init_helper(machine_pin_io_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { mplogger_print("init helper function called\n"); enum {ARG_mode, ARG_pull, ARG_value}; @@ -277,7 +277,7 @@ mp_obj_t mp_pin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, return MP_OBJ_FROM_PTR(self); } -STATIC mp_obj_t machine_pin_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) { +static mp_obj_t machine_pin_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 0, 1, false); machine_pin_io_obj_t *self = self_in; @@ -299,30 +299,30 @@ STATIC mp_obj_t machine_pin_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n } // pin.value([value]) -STATIC mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args) { +static mp_obj_t machine_pin_value(size_t n_args, const mp_obj_t *args) { return machine_pin_call(args[0], n_args - 1, 0, args + 1); } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_pin_value_obj, 1, 2, machine_pin_value); // instantiates obj of Pin class // Pin.init(mode,pull,value=value) -STATIC mp_obj_t machine_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t machine_pin_obj_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { return machine_pin_obj_init_helper(args[0], n_args - 1, args + 1, kw_args); } MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_obj_init_obj, 1, machine_pin_obj_init); // Pin.deinit() -STATIC mp_obj_t machine_pin_obj_deinit(mp_obj_t self_in) { +static mp_obj_t machine_pin_obj_deinit(mp_obj_t self_in) { machine_pin_io_obj_t *self = MP_OBJ_TO_PTR(self_in); cyhal_gpio_free(self->pin_phy->addr); pin_io_free(self); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_deinit_obj, machine_pin_obj_deinit); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_deinit_obj, machine_pin_obj_deinit); // Pin.toggle() -STATIC mp_obj_t machine_pin_toggle(mp_obj_t self_in) { +static mp_obj_t machine_pin_toggle(mp_obj_t self_in) { machine_pin_io_obj_t *self = MP_OBJ_TO_PTR(self_in); if (self->mode != GPIO_MODE_IN) { cyhal_gpio_toggle(self->pin_phy->addr); @@ -330,10 +330,10 @@ STATIC mp_obj_t machine_pin_toggle(mp_obj_t self_in) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_toggle_obj, machine_pin_toggle); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_toggle_obj, machine_pin_toggle); // Pin.high() -STATIC mp_obj_t machine_pin_high(mp_obj_t self_in) { +static mp_obj_t machine_pin_high(mp_obj_t self_in) { machine_pin_io_obj_t *self = MP_OBJ_TO_PTR(self_in); if (self->mode != GPIO_MODE_IN) { cyhal_gpio_write(self->pin_phy->addr, true); @@ -341,10 +341,10 @@ STATIC mp_obj_t machine_pin_high(mp_obj_t self_in) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_high_obj, machine_pin_high); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_high_obj, machine_pin_high); // Pin.low() -STATIC mp_obj_t machine_pin_low(mp_obj_t self_in) { +static mp_obj_t machine_pin_low(mp_obj_t self_in) { machine_pin_io_obj_t *self = MP_OBJ_TO_PTR(self_in); if (self->mode != GPIO_MODE_IN) { cyhal_gpio_write(self->pin_phy->addr, false); @@ -352,10 +352,10 @@ STATIC mp_obj_t machine_pin_low(mp_obj_t self_in) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_low_obj, machine_pin_low); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_pin_low_obj, machine_pin_low); // pin.irq(handler=None, trigger=IRQ_FALLING|IRQ_RISING) -STATIC mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_handler, ARG_trigger}; static const mp_arg_t allowed_args[] = { { MP_QSTR_handler, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} }, @@ -378,9 +378,9 @@ STATIC mp_obj_t machine_pin_irq(size_t n_args, const mp_obj_t *pos_args, mp_map_ } return MP_OBJ_FROM_PTR(&(self->callback_data)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq); +static MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq); -STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = { +static const mp_rom_map_elem_t machine_pin_locals_dict_table[] = { // Instance methods { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_machine) }, { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_pin_obj_init_obj) }, @@ -404,7 +404,7 @@ STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_IRQ_FALLING), MP_ROM_INT(GPIO_IRQ_FALLING)}, { MP_ROM_QSTR(MP_QSTR_IRQ_RISING), MP_ROM_INT(GPIO_IRQ_RISING)}, }; -STATIC MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table); +static MP_DEFINE_CONST_DICT(machine_pin_locals_dict, machine_pin_locals_dict_table); void mod_pin_deinit() { for (uint8_t i = 0; i < machine_pin_num_of_cpu_pins; i++) { @@ -414,7 +414,7 @@ void mod_pin_deinit() { } } -STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) { +static mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) { (void)errcode; machine_pin_io_obj_t *self = self_in; switch (request) { @@ -429,7 +429,7 @@ STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, i return -1; } -STATIC const mp_pin_p_t pin_pin_p = { +static const mp_pin_p_t pin_pin_p = { .ioctl = pin_ioctl, }; diff --git a/ports/psoc6/machine_pwm.c b/ports/psoc6/machine_pwm.c index 1b411b093fdbb..5b15e0472cce8 100644 --- a/ports/psoc6/machine_pwm.c +++ b/ports/psoc6/machine_pwm.c @@ -20,7 +20,7 @@ typedef struct _machine_pwm_obj_t { static machine_pwm_obj_t *pwm_obj[MAX_PWM_OBJS] = { NULL }; -STATIC inline machine_pwm_obj_t *pwm_obj_alloc() { +static inline machine_pwm_obj_t *pwm_obj_alloc() { for (uint8_t i = 0; i < MAX_PWM_OBJS; i++) { if (pwm_obj[i] == NULL) { @@ -32,7 +32,7 @@ STATIC inline machine_pwm_obj_t *pwm_obj_alloc() { return NULL; } -STATIC inline void pwm_obj_free(machine_pwm_obj_t *pwm_obj_ptr) { +static inline void pwm_obj_free(machine_pwm_obj_t *pwm_obj_ptr) { for (uint8_t i = 0; i < MAX_PWM_OBJS; i++) { if (pwm_obj[i] == pwm_obj_ptr) { @@ -41,7 +41,7 @@ STATIC inline void pwm_obj_free(machine_pwm_obj_t *pwm_obj_ptr) { } } -STATIC inline void pwm_pin_alloc(machine_pwm_obj_t *pwm_obj, mp_obj_t pin_name) { +static inline void pwm_pin_alloc(machine_pwm_obj_t *pwm_obj, mp_obj_t pin_name) { machine_pin_phy_obj_t *pin = pin_phy_realloc(pin_name, PIN_PHY_FUNC_PWM); if (pin == NULL) { @@ -52,7 +52,7 @@ STATIC inline void pwm_pin_alloc(machine_pwm_obj_t *pwm_obj, mp_obj_t pin_name) pwm_obj->pin = pin; } -STATIC inline void pwm_pin_free(machine_pwm_obj_t *pwm_obj) { +static inline void pwm_pin_free(machine_pwm_obj_t *pwm_obj) { pin_phy_free(pwm_obj->pin); } @@ -63,13 +63,13 @@ enum { DUTY_NS }; -STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq); +static void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq); -STATIC cy_rslt_t pwm_freq_duty_set(cyhal_pwm_t *pwm_obj, uint32_t fz, float duty_cycle) { +static cy_rslt_t pwm_freq_duty_set(cyhal_pwm_t *pwm_obj, uint32_t fz, float duty_cycle) { return cyhal_pwm_set_duty_cycle(pwm_obj, duty_cycle * 100, fz); // duty_cycle in percentage } -STATIC inline cy_rslt_t pwm_duty_set_ns(cyhal_pwm_t *pwm_obj, uint32_t fz, uint32_t pulse_width) { +static inline cy_rslt_t pwm_duty_set_ns(cyhal_pwm_t *pwm_obj, uint32_t fz, uint32_t pulse_width) { return cyhal_pwm_set_period(pwm_obj, 1000000 / fz, pulse_width / 1000); // !# * --> / } @@ -77,12 +77,12 @@ STATIC inline cy_rslt_t pwm_duty_set_ns(cyhal_pwm_t *pwm_obj, uint32_t fz, uint3 return cyhal_pwm_init_adv(&machine_pwm_obj->pwm_obj, machine_pwm_obj->pin->addr, NC, CYHAL_PWM_LEFT_ALIGN, true, 0, true, NULL); // complimentary pin set as not connected }*/ -STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +static void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { machine_pwm_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_printf(print, "frequency=%u duty_cycle=%f", self->fz, (double)self->duty); } -STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, +static void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_freq, ARG_duty_u16, ARG_duty_ns}; // enum { ARG_freq, ARG_duty_u16, ARG_duty_ns, ARG_invert }; @@ -133,7 +133,7 @@ STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, cyhal_pwm_start(&self->pwm_obj); } -STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { +static mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { // Check number of arguments mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true); @@ -160,13 +160,13 @@ STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args return MP_OBJ_FROM_PTR(self); } -STATIC void mp_machine_pwm_deinit(machine_pwm_obj_t *self) { +static void mp_machine_pwm_deinit(machine_pwm_obj_t *self) { cyhal_pwm_free(&self->pwm_obj); pwm_pin_free(self); pwm_obj_free(self); } -STATIC mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) { +static mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) { if (self->duty_type == DUTY_NS) { // duty_cycle = pulsewidth(ns)*freq(hz); return mp_obj_new_float(((self->duty) * (self->fz) * 65535) / 1000000000 - 1); @@ -176,14 +176,14 @@ STATIC mp_obj_t mp_machine_pwm_duty_get_u16(machine_pwm_obj_t *self) { } // sets the duty cycle as a ratio duty_u16 / 65535. -STATIC void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16) { +static void mp_machine_pwm_duty_set_u16(machine_pwm_obj_t *self, mp_int_t duty_u16) { // Check the value is more than the max value self->duty = duty_u16 > 65535 ? 65535 : duty_u16; self->duty_type = DUTY_U16; pwm_freq_duty_set(&self->pwm_obj, self->fz, (float)(self->duty) / (float)65535); // s conversion of duty_u16 into dutyu16/65535 } -STATIC mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) { +static mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) { if (self->duty_type == DUTY_U16) { return mp_obj_new_float(((self->duty) * 1000000000) / ((self->fz) * 65535)); // pw (ns) = duty_cycle*10^9/fz } else { @@ -192,18 +192,18 @@ STATIC mp_obj_t mp_machine_pwm_duty_get_ns(machine_pwm_obj_t *self) { } // sets the pulse width in nanoseconds -STATIC void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns) { +static void mp_machine_pwm_duty_set_ns(machine_pwm_obj_t *self, mp_int_t duty_ns) { self->duty = duty_ns; self->duty_type = DUTY_NS; pwm_duty_set_ns(&self->pwm_obj, self->fz, duty_ns); } -STATIC mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) { +static mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) { return MP_OBJ_NEW_SMALL_INT(self->fz); } -STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) { +static void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) { self->fz = freq; pwm_freq_duty_set(&self->pwm_obj, freq, self->duty); if (self->duty_type == DUTY_NS) { diff --git a/ports/psoc6/machine_rtc.c b/ports/psoc6/machine_rtc.c index ad7537a2caa34..abdcc3bb46b91 100644 --- a/ports/psoc6/machine_rtc.c +++ b/ports/psoc6/machine_rtc.c @@ -67,7 +67,7 @@ typedef struct _machine_rtc_obj_t { // singleton RTC object -STATIC const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}}; +static const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}}; /* This function is run from main.c to init the RTC at boot time. This will set the RTC to PSoC default time: 1st Jan 2000*/ void rtc_init(void) { @@ -80,14 +80,14 @@ void rtc_init(void) { // Machine RTC methods - port-specific definitions // RTC constructor -STATIC mp_obj_t machine_rtc_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 machine_rtc_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, 0, 0, false); // return constant object return (mp_obj_t)&machine_rtc_obj; } // Helper function to set/get datetime -STATIC mp_obj_t machine_rtc_datetime_helper(mp_uint_t n_args, const mp_obj_t *args) { +static mp_obj_t machine_rtc_datetime_helper(mp_uint_t n_args, const mp_obj_t *args) { if (n_args == 1) { struct tm current_date_time = {0}; cy_rslt_t result = cyhal_rtc_read(&psoc6_rtc, ¤t_date_time); @@ -132,13 +132,13 @@ STATIC mp_obj_t machine_rtc_datetime_helper(mp_uint_t n_args, const mp_obj_t *ar } // RTC.datetime([datetime]) -STATIC mp_obj_t machine_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) { +static mp_obj_t machine_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) { return machine_rtc_datetime_helper(n_args, args); } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_datetime_obj, 1, 2, machine_rtc_datetime); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_datetime_obj, 1, 2, machine_rtc_datetime); // RTC.init(datetime) -STATIC mp_obj_t machine_rtc_init(mp_obj_t self_in, mp_obj_t date) { +static mp_obj_t machine_rtc_init(mp_obj_t self_in, mp_obj_t date) { mp_obj_t args[2] = {self_in, date}; // Check if RTC is correctly initialized already through main bool r = cyhal_rtc_is_enabled(&psoc6_rtc); @@ -148,10 +148,10 @@ STATIC mp_obj_t machine_rtc_init(mp_obj_t self_in, mp_obj_t date) { machine_rtc_datetime_helper(2, args); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_rtc_init_obj, machine_rtc_init); +static MP_DEFINE_CONST_FUN_OBJ_2(machine_rtc_init_obj, machine_rtc_init); // RTC.deinit() -STATIC mp_obj_t machine_rtc_deinit(mp_obj_t self_in) { +static mp_obj_t machine_rtc_deinit(mp_obj_t self_in) { /* Resets RTC to 1st Jan' 2015 as mentioned in MPY guide*/ struct tm reset_date_time = { .tm_year = RTC_INIT_YEAR - TM_YEAR_BASE, @@ -169,21 +169,21 @@ STATIC mp_obj_t machine_rtc_deinit(mp_obj_t self_in) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_rtc_deinit_obj, machine_rtc_deinit); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_rtc_deinit_obj, machine_rtc_deinit); // RTC.now() -STATIC mp_obj_t machine_rtc_now(mp_obj_t self_in) { +static mp_obj_t machine_rtc_now(mp_obj_t self_in) { return machine_rtc_datetime_helper(1, NULL); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_rtc_now_obj, machine_rtc_now); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_rtc_now_obj, machine_rtc_now); -STATIC const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = { +static const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_rtc_init_obj) }, { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_rtc_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR_datetime), MP_ROM_PTR(&machine_rtc_datetime_obj) }, { MP_ROM_QSTR(MP_QSTR_now), MP_ROM_PTR(&machine_rtc_now_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table); +static MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( machine_rtc_type, diff --git a/ports/psoc6/machine_spi.c b/ports/psoc6/machine_spi.c index a17103e4d10f3..dcab82a39dc57 100644 --- a/ports/psoc6/machine_spi.c +++ b/ports/psoc6/machine_spi.c @@ -63,7 +63,7 @@ static inline void spi_obj_free(machine_spi_obj_t *spi_obj_ptr) { } } -STATIC inline void spi_sck_alloc(machine_spi_obj_t *spi_obj, mp_obj_t pin_name) { +static inline void spi_sck_alloc(machine_spi_obj_t *spi_obj, mp_obj_t pin_name) { machine_pin_phy_obj_t *sck = pin_phy_realloc(pin_name, PIN_PHY_FUNC_SPI); if (sck == NULL) { @@ -74,11 +74,11 @@ STATIC inline void spi_sck_alloc(machine_spi_obj_t *spi_obj, mp_obj_t pin_name) spi_obj->sck = sck; } -STATIC inline void spi_sck_free(machine_spi_obj_t *spi_obj) { +static inline void spi_sck_free(machine_spi_obj_t *spi_obj) { pin_phy_free(spi_obj->sck); } -STATIC inline void spi_mosi_alloc(machine_spi_obj_t *spi_obj, mp_obj_t pin_name) { +static inline void spi_mosi_alloc(machine_spi_obj_t *spi_obj, mp_obj_t pin_name) { machine_pin_phy_obj_t *mosi = pin_phy_realloc(pin_name, PIN_PHY_FUNC_SPI); if (mosi == NULL) { @@ -89,11 +89,11 @@ STATIC inline void spi_mosi_alloc(machine_spi_obj_t *spi_obj, mp_obj_t pin_name) spi_obj->mosi = mosi; } -STATIC inline void spi_mosi_free(machine_spi_obj_t *spi_obj) { +static inline void spi_mosi_free(machine_spi_obj_t *spi_obj) { pin_phy_free(spi_obj->mosi); } -STATIC inline void spi_miso_alloc(machine_spi_obj_t *spi_obj, mp_obj_t pin_name) { +static inline void spi_miso_alloc(machine_spi_obj_t *spi_obj, mp_obj_t pin_name) { machine_pin_phy_obj_t *miso = pin_phy_realloc(pin_name, PIN_PHY_FUNC_SPI); if (miso == NULL) { @@ -104,12 +104,12 @@ STATIC inline void spi_miso_alloc(machine_spi_obj_t *spi_obj, mp_obj_t pin_name) spi_obj->miso = miso; } -STATIC inline void spi_miso_free(machine_spi_obj_t *spi_obj) { +static inline void spi_miso_free(machine_spi_obj_t *spi_obj) { pin_phy_free(spi_obj->miso); } // Function to select the mode -STATIC cyhal_spi_mode_t mode_select(uint8_t firstbit, uint8_t polarity, uint8_t phase) { +static cyhal_spi_mode_t mode_select(uint8_t firstbit, uint8_t polarity, uint8_t phase) { cyhal_spi_mode_t mode; if (firstbit == 1) { @@ -144,7 +144,7 @@ STATIC cyhal_spi_mode_t mode_select(uint8_t firstbit, uint8_t polarity, uint8_t return mode; } -STATIC void machine_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +static void machine_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { machine_spi_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_printf(print, "SPI(id=%u, baudrate=%u, polarity=%u, phase=%u, bits=%u, firstbit=%u, sck=%d, mosi=%d, miso=%d)", self->spi_id, self->baudrate, self->polarity, @@ -238,7 +238,7 @@ mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n return MP_OBJ_FROM_PTR(self); } -STATIC void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits, ARG_firstbit }; static const mp_arg_t allowed_args[] = { { MP_QSTR_baudrate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, @@ -286,7 +286,7 @@ STATIC void machine_spi_init(mp_obj_base_t *self_in, size_t n_args, const mp_obj } } -STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) { +static void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) { machine_spi_obj_t *self = (machine_spi_obj_t *)self_in; cy_rslt_t result; @@ -315,7 +315,7 @@ STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8 } -STATIC void machine_spi_deinit(mp_obj_base_t *self_in) { +static void machine_spi_deinit(mp_obj_base_t *self_in) { machine_spi_obj_t *self = (machine_spi_obj_t *)self_in; cyhal_spi_free(&self->spi_obj); spi_sck_free(self); @@ -324,7 +324,7 @@ STATIC void machine_spi_deinit(mp_obj_base_t *self_in) { spi_obj_free(self); } -STATIC const mp_machine_spi_p_t machine_spi_p = { +static const mp_machine_spi_p_t machine_spi_p = { .init = machine_spi_init, .deinit = machine_spi_deinit, .transfer = machine_spi_transfer, diff --git a/ports/psoc6/machine_timer.c b/ports/psoc6/machine_timer.c index 05f63340ad9d3..8586838f9d893 100644 --- a/ports/psoc6/machine_timer.c +++ b/ports/psoc6/machine_timer.c @@ -28,13 +28,13 @@ static void isr_timer(void *callback_arg, cyhal_timer_event_t event) { } -STATIC void machine_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +static void machine_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { machine_timer_obj_t *self = MP_OBJ_TO_PTR(self_in); qstr mode = self->mode == TIMER_MODE_ONE_SHOT ? MP_QSTR_ONE_SHOT : MP_QSTR_PERIODIC; mp_printf(print, "Timer(mode=%q, period=%u, tick_hz=%u)", mode, self->period, self->freq); } -STATIC mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_mode, ARG_callback, ARG_period, ARG_freq, }; static const mp_arg_t allowed_args[] = { { MP_QSTR_mode, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = TIMER_MODE_ONE_SHOT} }, @@ -93,7 +93,7 @@ STATIC mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, size_t n_ar return mp_const_none; } -STATIC mp_obj_t machine_timer_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 machine_timer_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, 1, MP_OBJ_FUN_ARGS_MAX, true); machine_timer_obj_t *self = mp_obj_malloc(machine_timer_obj_t, &machine_timer_type); @@ -120,21 +120,21 @@ STATIC mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(self); } -STATIC mp_obj_t machine_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t machine_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { machine_timer_obj_t *self = MP_OBJ_TO_PTR(args[0]); return machine_timer_init_helper(self, n_args - 1, args + 1, kw_args); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_timer_init_obj, 1, machine_timer_init); +static MP_DEFINE_CONST_FUN_OBJ_KW(machine_timer_init_obj, 1, machine_timer_init); -STATIC mp_obj_t machine_timer_deinit(mp_obj_t self_in) { +static mp_obj_t machine_timer_deinit(mp_obj_t self_in) { machine_timer_obj_t *self = MP_OBJ_TO_PTR(self_in); cyhal_timer_free(&self->timer_obj); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_deinit_obj, machine_timer_deinit); +static MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_deinit_obj, machine_timer_deinit); -STATIC const mp_rom_map_elem_t machine_timer_locals_dict_table[] = { +static const mp_rom_map_elem_t machine_timer_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&machine_timer_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_timer_init_obj) }, { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_timer_deinit_obj) }, @@ -143,7 +143,7 @@ STATIC const mp_rom_map_elem_t machine_timer_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_PERIODIC), MP_ROM_INT(TIMER_MODE_PERIODIC) }, }; -STATIC MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table); +static MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( machine_timer_type, diff --git a/ports/psoc6/modmachine.c b/ports/psoc6/modmachine.c index 03f05605ac371..eae54add47089 100644 --- a/ports/psoc6/modmachine.c +++ b/ports/psoc6/modmachine.c @@ -26,13 +26,13 @@ enum {MACHINE_PWRON_RESET, MACHINE_HARD_RESET, MACHINE_WDT_RESET, MACHINE_DEEPSL // function to return 64-bit silicon ID of given PSoC microcontroller // A combined 64-bit unique ID. [63:57] - DIE_YEAR [56:56] - DIE_MINOR [55:48] - DIE_SORT [47:40] - DIE_Y [39:32] - DIE_X [31:24] - DIE_WAFER [23:16] - DIE_LOT[2] [15: 8] - DIE_LOT[1] [ 7: 0] - DIE_LOT[0] -STATIC uint64_t system_get_unique_id(void) { +static uint64_t system_get_unique_id(void) { return Cy_SysLib_GetUniqueId(); } // using watchdog timer to count to minimum value (1ms) to trigger reset // thread-safe way as other methods might interfere with pending interrupts, threads etc. -STATIC void system_reset(void) { +static void system_reset(void) { cyhal_wdt_t wdt_obj; cyhal_wdt_init(&wdt_obj, 1); // min 1ms count time cyhal_wdt_start(&wdt_obj); @@ -40,12 +40,12 @@ STATIC void system_reset(void) { // get reset cause of the last system reset // macros defined here: cy_syslib.h -STATIC uint32_t system_reset_cause(void) { +static uint32_t system_reset_cause(void) { return Cy_SysLib_GetResetReason(); } // helper function to generate random alphanumeric hash -STATIC uint8_t system_rand_hash(uint8_t length) { +static uint8_t system_rand_hash(uint8_t length) { uint8_t hash_sum = 0; char charset[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; // hash can be made stronger but // uint8_t can only hold <=255 @@ -66,7 +66,7 @@ static uint8_t system_irq_key; // function to disable global IRQs // returns alphanumeric hash to enable IRQs later // see: https://docs.zephyrproject.org/apidoc/latest/group__isr__apis.html#ga19fdde73c3b02fcca6cf1d1e67631228 -STATIC uint8_t system_disable_global_irq(void) { +static uint8_t system_disable_global_irq(void) { uint8_t state = system_rand_hash(HASH_CHARS_NUM); // 10 chars long key gen; __disable_irq(); system_irq_key = state; @@ -75,7 +75,7 @@ STATIC uint8_t system_disable_global_irq(void) { // function to enable global IRQs // uses passed alphanumeric key to verify and enable IRQs -STATIC bool system_enable_global_irq(uint8_t state) { +static bool system_enable_global_irq(uint8_t state) { if (state == system_irq_key) { __enable_irq(); return true; @@ -85,14 +85,14 @@ STATIC bool system_enable_global_irq(uint8_t state) { } // API to return clock freq; Fast CLK (CM4) is the main sys clk -STATIC uint32_t system_get_cpu_freq(void) { +static uint32_t system_get_cpu_freq(void) { // return Cy_SysClk_ClkPathMuxGetFrequency(Cy_SysClk_ClkPathGetSource(0UL)); return Cy_SysClk_ClkFastGetFrequency(); } // TODO: unused. Required ? // API to return clock freq divider for Fast CLK (CM4) -// STATIC uint8_t system_get_cpu_freq_div(void) { +// static uint8_t system_get_cpu_freq_div(void) { // return Cy_SysClk_ClkFastGetDivider(); // } @@ -112,7 +112,7 @@ void machine_deinit(void) { // machine.info([dump_alloc_table]) // Print out lots of information about the board. -STATIC mp_obj_t machine_info(size_t n_args, const mp_obj_t *args) { +static mp_obj_t machine_info(size_t n_args, const mp_obj_t *args) { mp_printf(&mp_plat_print, "\nmachine info :\n"); // qstr info @@ -188,25 +188,25 @@ STATIC mp_obj_t machine_info(size_t n_args, const mp_obj_t *args) { MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_info_obj, 0, 1, machine_info); -STATIC mp_obj_t mp_machine_get_freq(void) { +static mp_obj_t mp_machine_get_freq(void) { mp_printf(&mp_plat_print, "System core freq (CM4): %d Hz\n", system_get_cpu_freq()); return mp_const_none; } -STATIC void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) { +static void mp_machine_set_freq(size_t n_args, const mp_obj_t *args) { mp_raise_NotImplementedError(MP_ERROR_TEXT("Not implemented!!!\n")); } -STATIC void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) { +static void mp_machine_lightsleep(size_t n_args, const mp_obj_t *args) { mp_raise_NotImplementedError(MP_ERROR_TEXT("Not implemented!!!\n")); } -NORETURN STATIC void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) { +NORETURN static void mp_machine_deepsleep(size_t n_args, const mp_obj_t *args) { mp_raise_NotImplementedError(MP_ERROR_TEXT("Not implemented!!!\n")); } // machine.unique_id() -STATIC mp_obj_t mp_machine_unique_id(void) { +static mp_obj_t mp_machine_unique_id(void) { uint64_t id = system_get_unique_id(); byte *id_addr = (byte *)&id; mplogger_print("ID_formatted:%02x%02x%02x%02x:%02x%02x%02x%02x\n", id_addr[0], id_addr[1], id_addr[2], id_addr[3], id_addr[4], id_addr[5], id_addr[6], id_addr[7]); @@ -215,14 +215,14 @@ STATIC mp_obj_t mp_machine_unique_id(void) { } // machine.reset() -NORETURN STATIC void mp_machine_reset(void) { +NORETURN static void mp_machine_reset(void) { system_reset(); while (true) { } ; } -STATIC mp_int_t mp_machine_reset_cause(void) { +static mp_int_t mp_machine_reset_cause(void) { qstr mp_reset_qstr = MP_QSTR_None; uint8_t reset_cause_const = -1; uint32_t reset_cause = system_reset_cause(); @@ -249,7 +249,7 @@ STATIC mp_int_t mp_machine_reset_cause(void) { } // machine.disable_irq() -STATIC mp_obj_t machine_disable_irq(void) { +static mp_obj_t machine_disable_irq(void) { uint32_t state = system_disable_global_irq(); mplogger_print("IRQ State: "); return mp_obj_new_int(state); @@ -257,7 +257,7 @@ STATIC mp_obj_t machine_disable_irq(void) { MP_DEFINE_CONST_FUN_OBJ_0(machine_disable_irq_obj, machine_disable_irq); // machine.enable_irq() -STATIC mp_obj_t machine_enable_irq(mp_obj_t state_in) { +static mp_obj_t machine_enable_irq(mp_obj_t state_in) { uint32_t state = mp_obj_get_int(state_in); bool result = system_enable_global_irq(state); if (result) { @@ -273,7 +273,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(machine_enable_irq_obj, machine_enable_irq); // This executies a wfi machine instruction which reduces power consumption // of the MCU until an interrupt occurs, at which point execution continues. // see: https://www.infineon.com/dgdl/Infineon-AN219528_PSoC_6_MCU_low-power_modes_and_power_reduction_techniques-ApplicationNotes-v06_00-EN.pdf?fileId=8ac78c8c7cdc391c017d0d31efdc659f pg.7 -STATIC void mp_machine_idle(void) { +static void mp_machine_idle(void) { __WFI(); // standard ARM instruction } diff --git a/ports/psoc6/modos.c b/ports/psoc6/modos.c index 3946e396748c1..5410af3ab64f0 100644 --- a/ports/psoc6/modos.c +++ b/ports/psoc6/modos.c @@ -52,33 +52,33 @@ void os_deinit(void) { #if MICROPY_PY_OS_GETENV_PUTENV_UNSETENV -STATIC mp_obj_t mp_os_getenv(mp_obj_t var_in) { +static mp_obj_t mp_os_getenv(mp_obj_t var_in) { const char *s = getenv(mp_obj_str_get_str(var_in)); if (s == NULL) { return mp_const_none; } return mp_obj_new_str(s, strlen(s)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_getenv_obj, mp_os_getenv); +static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_getenv_obj, mp_os_getenv); -STATIC mp_obj_t mp_os_putenv(mp_obj_t var, mp_obj_t value) { +static mp_obj_t mp_os_putenv(mp_obj_t var, mp_obj_t value) { setenv(mp_obj_str_get_str(var), mp_obj_str_get_str(value), 1); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_os_putenv_obj, mp_os_putenv); +static MP_DEFINE_CONST_FUN_OBJ_2(mp_os_putenv_obj, mp_os_putenv); -STATIC mp_obj_t mp_os_unsetenv(mp_obj_t var) { +static mp_obj_t mp_os_unsetenv(mp_obj_t var) { unsetenv(mp_obj_str_get_str(var)); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_unsetenv_obj, mp_os_unsetenv); +static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_unsetenv_obj, mp_os_unsetenv); #endif -STATIC mp_obj_t mp_os_system(mp_obj_t cmd_in) { +static mp_obj_t mp_os_system(mp_obj_t cmd_in) { const char *cmd = mp_obj_str_get_str(cmd_in); MP_THREAD_GIL_EXIT(); @@ -89,10 +89,10 @@ STATIC mp_obj_t mp_os_system(mp_obj_t cmd_in) { return MP_OBJ_NEW_SMALL_INT(r); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_os_system_obj, mp_os_system); +static MP_DEFINE_CONST_FUN_OBJ_1(mp_os_system_obj, mp_os_system); -STATIC mp_obj_t mp_os_errno(size_t n_args, const mp_obj_t *args) { +static mp_obj_t mp_os_errno(size_t n_args, const mp_obj_t *args) { if (n_args == 0) { return MP_OBJ_NEW_SMALL_INT(errno); } @@ -100,4 +100,4 @@ STATIC mp_obj_t mp_os_errno(size_t n_args, const mp_obj_t *args) { errno = mp_obj_get_int(args[0]); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_os_errno_obj, 0, 1, mp_os_errno); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_os_errno_obj, 0, 1, mp_os_errno); diff --git a/ports/psoc6/modpsoc6.c b/ports/psoc6/modpsoc6.c index 76a0f0ffcd3d8..31118f20c38c7 100644 --- a/ports/psoc6/modpsoc6.c +++ b/ports/psoc6/modpsoc6.c @@ -32,7 +32,7 @@ #include "modpsoc6.h" -STATIC const mp_rom_map_elem_t psoc6_module_globals_table[] = { +static const mp_rom_map_elem_t psoc6_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_psoc6) }, #if MICROPY_ENABLE_EXT_QSPI_FLASH { MP_ROM_QSTR(MP_QSTR_QSPI_Flash), MP_ROM_PTR(&psoc6_qspi_flash_type) }, @@ -40,7 +40,7 @@ STATIC const mp_rom_map_elem_t psoc6_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_Flash), MP_ROM_PTR(&psoc6_flash_type) }, #endif }; -STATIC MP_DEFINE_CONST_DICT(psoc6_module_globals, psoc6_module_globals_table); +static MP_DEFINE_CONST_DICT(psoc6_module_globals, psoc6_module_globals_table); const mp_obj_module_t mp_module_psoc6 = { diff --git a/ports/psoc6/modtime.c b/ports/psoc6/modtime.c index 6444f2dd26567..443a69ffa5ae8 100644 --- a/ports/psoc6/modtime.c +++ b/ports/psoc6/modtime.c @@ -69,7 +69,7 @@ void time_deinit(void) { // Convert a time expressed in seconds since the Epoch into an 8-tuple which // contains: (year, month, mday, hour, minute, second, weekday, yearday) -STATIC mp_obj_t mp_time_localtime_get(void) { +static mp_obj_t mp_time_localtime_get(void) { struct tm current_date_time = {0}; cy_rslt_t result = cyhal_rtc_read(&psoc6_rtc, ¤t_date_time); @@ -93,7 +93,7 @@ STATIC mp_obj_t mp_time_localtime_get(void) { // time() // Return the number of seconds since the Epoch. -STATIC mp_obj_t mp_time_time_get(void) { +static mp_obj_t mp_time_time_get(void) { struct tm current_date_time = {0}; cy_rslt_t result = cyhal_rtc_read(&psoc6_rtc, ¤t_date_time); diff --git a/ports/psoc6/network_ifx_wcm.c b/ports/psoc6/network_ifx_wcm.c index 2e14535015437..7a1117dc5d395 100644 --- a/ports/psoc6/network_ifx_wcm.c +++ b/ports/psoc6/network_ifx_wcm.c @@ -96,8 +96,8 @@ typedef struct _network_ifx_wcm_obj_t { extern whd_interface_t whd_ifs[MAX_WHD_INTERFACE]; -STATIC network_ifx_wcm_obj_t network_ifx_wcm_wl_sta = { { &mp_network_ifx_wcm_type }, CY_WCM_INTERFACE_TYPE_STA }; -STATIC network_ifx_wcm_obj_t network_ifx_wcm_wl_ap = { { &mp_network_ifx_wcm_type }, CY_WCM_INTERFACE_TYPE_AP }; +static network_ifx_wcm_obj_t network_ifx_wcm_wl_sta = { { &mp_network_ifx_wcm_type }, CY_WCM_INTERFACE_TYPE_STA }; +static network_ifx_wcm_obj_t network_ifx_wcm_wl_ap = { { &mp_network_ifx_wcm_type }, CY_WCM_INTERFACE_TYPE_AP }; #define wcm_get_ap_conf_ptr(net_obj) & (net_obj.itf_obj.ap_obj.ap_config) #define wcm_get_sta_conf_ptr(net_obj) & (net_obj.itf_obj.sta_obj) @@ -127,7 +127,7 @@ void network_ap_init() { wcm_assert_raise("network ap ip setting error (code: %d)", ret); } -STATIC void restart_ap(cy_wcm_ap_config_t *ap_conf) { +static void restart_ap(cy_wcm_ap_config_t *ap_conf) { if (cy_wcm_is_ap_up()) { uint32_t ret = cy_wcm_stop_ap(); wcm_assert_raise("network ap deactivate error (with code: %d)", ret); @@ -154,7 +154,7 @@ void network_init(void) { } // Print after constructor invoked -STATIC void network_ifx_wcm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +static void network_ifx_wcm_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { network_ifx_wcm_obj_t *self = MP_OBJ_TO_PTR(self_in); const char *status_str; @@ -188,7 +188,7 @@ STATIC void network_ifx_wcm_print(const mp_print_t *print, mp_obj_t self_in, mp_ ); } -STATIC mp_obj_t network_ifx_wcm_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 network_ifx_wcm_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, 0, 1, false); if (n_args == 0 || mp_obj_get_int(args[0]) == MOD_NETWORK_STA_IF) { @@ -202,14 +202,14 @@ STATIC mp_obj_t network_ifx_wcm_make_new(const mp_obj_type_t *type, size_t n_arg /*******************************************************************************/ // network API -STATIC mp_obj_t network_ifx_wcm_deinit(mp_obj_t self_in) { +static mp_obj_t network_ifx_wcm_deinit(mp_obj_t self_in) { network_deinit(); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_ifx_wcm_deinit_obj, network_ifx_wcm_deinit); +static MP_DEFINE_CONST_FUN_OBJ_1(network_ifx_wcm_deinit_obj, network_ifx_wcm_deinit); -STATIC mp_obj_t network_ifx_wcm_active(size_t n_args, const mp_obj_t *args) { +static mp_obj_t network_ifx_wcm_active(size_t n_args, const mp_obj_t *args) { cy_rslt_t ret = CY_RSLT_SUCCESS; network_ifx_wcm_obj_t *self = MP_OBJ_TO_PTR(args[0]); @@ -234,7 +234,7 @@ STATIC mp_obj_t network_ifx_wcm_active(size_t n_args, const mp_obj_t *args) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_ifx_wcm_active_obj, 1, 2, network_ifx_wcm_active); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_ifx_wcm_active_obj, 1, 2, network_ifx_wcm_active); typedef struct { @@ -321,7 +321,7 @@ static void network_ifx_wcm_scan_cb(cy_wcm_scan_result_t *result_ptr, void *user scan_user_data->status = status; } -STATIC mp_obj_t network_ifx_wcm_scan(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { +static mp_obj_t network_ifx_wcm_scan(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { network_ifx_wcm_obj_t *self = MP_OBJ_TO_PTR(args[0]); cy_rslt_t ret = CY_RSLT_SUCCESS; @@ -389,9 +389,9 @@ STATIC mp_obj_t network_ifx_wcm_scan(size_t n_args, const mp_obj_t *args, mp_map return scan_user_params.scan_list; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_ifx_wcm_scan_obj, 1, network_ifx_wcm_scan); +static MP_DEFINE_CONST_FUN_OBJ_KW(network_ifx_wcm_scan_obj, 1, network_ifx_wcm_scan); -STATIC mp_obj_t network_ifx_wcm_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +static mp_obj_t network_ifx_wcm_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { network_ifx_wcm_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); enum { ARG_ssid, ARG_key, ARG_bssid }; @@ -451,9 +451,9 @@ STATIC mp_obj_t network_ifx_wcm_connect(size_t n_args, const mp_obj_t *pos_args, return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_ifx_wcm_connect_obj, 1, network_ifx_wcm_connect); +static MP_DEFINE_CONST_FUN_OBJ_KW(network_ifx_wcm_connect_obj, 1, network_ifx_wcm_connect); -STATIC mp_obj_t network_ifx_wcm_disconnect(mp_obj_t self_in) { +static mp_obj_t network_ifx_wcm_disconnect(mp_obj_t self_in) { network_ifx_wcm_obj_t *self = MP_OBJ_TO_PTR(self_in); if (self->itf != CY_WCM_INTERFACE_TYPE_STA) { @@ -463,9 +463,9 @@ STATIC mp_obj_t network_ifx_wcm_disconnect(mp_obj_t self_in) { wcm_assert_raise("network sta disconnect error (with code: %d)", ret); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_ifx_wcm_disconnect_obj, network_ifx_wcm_disconnect); +static MP_DEFINE_CONST_FUN_OBJ_1(network_ifx_wcm_disconnect_obj, network_ifx_wcm_disconnect); -STATIC mp_obj_t network_ifx_wcm_isconnected(mp_obj_t self_in) { +static mp_obj_t network_ifx_wcm_isconnected(mp_obj_t self_in) { network_ifx_wcm_obj_t *self = MP_OBJ_TO_PTR(self_in); if (self->itf == CY_WCM_INTERFACE_TYPE_STA) { @@ -487,9 +487,9 @@ STATIC mp_obj_t network_ifx_wcm_isconnected(mp_obj_t self_in) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_ifx_wcm_isconnected_obj, network_ifx_wcm_isconnected); +static MP_DEFINE_CONST_FUN_OBJ_1(network_ifx_wcm_isconnected_obj, network_ifx_wcm_isconnected); -STATIC mp_obj_t network_ifx_wcm_ifconfig(size_t n_args, const mp_obj_t *args) { +static mp_obj_t network_ifx_wcm_ifconfig(size_t n_args, const mp_obj_t *args) { network_ifx_wcm_obj_t *self = MP_OBJ_TO_PTR(args[0]); if (n_args == 1) { const ip_addr_t *dns = dns_getserver(0); @@ -535,7 +535,7 @@ STATIC mp_obj_t network_ifx_wcm_ifconfig(size_t n_args, const mp_obj_t *args) { } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_ifx_wcm_ifconfig_obj, 1, 2, network_ifx_wcm_ifconfig); -STATIC mp_obj_t network_ifx_wcm_status(size_t n_args, const mp_obj_t *args) { +static mp_obj_t network_ifx_wcm_status(size_t n_args, const mp_obj_t *args) { network_ifx_wcm_obj_t *self = MP_OBJ_TO_PTR(args[0]); // one argument: return status based on query parameter @@ -574,10 +574,10 @@ STATIC mp_obj_t network_ifx_wcm_status(size_t n_args, const mp_obj_t *args) { mp_raise_ValueError(MP_ERROR_TEXT("network status unknown param")); } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_ifx_wcm_status_obj, 1, 2, network_ifx_wcm_status); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_ifx_wcm_status_obj, 1, 2, network_ifx_wcm_status); -STATIC mp_obj_t network_ap_get_config_param(cy_wcm_ap_config_t *ap_conf, qstr query_opt) { +static mp_obj_t network_ap_get_config_param(cy_wcm_ap_config_t *ap_conf, qstr query_opt) { switch (query_opt) { case MP_QSTR_channel: { return MP_OBJ_NEW_SMALL_INT(ap_conf->channel); @@ -621,7 +621,7 @@ STATIC mp_obj_t network_ap_get_config_param(cy_wcm_ap_config_t *ap_conf, qstr qu } } -STATIC mp_obj_t network_sta_get_config_param(network_ifx_wcm_sta_obj_t *sta_conf, qstr query_opt) { +static mp_obj_t network_sta_get_config_param(network_ifx_wcm_sta_obj_t *sta_conf, qstr query_opt) { switch (query_opt) { case MP_QSTR_channel: { cy_wcm_associated_ap_info_t ap_info; @@ -691,7 +691,7 @@ cy_wcm_security_t get_wm_security_type(mp_obj_t mpy_sec) { } } -STATIC void network_ap_set_config_param(cy_wcm_ap_config_t *ap_conf, qstr opt, mp_obj_t opt_value, bool hold) { +static void network_ap_set_config_param(cy_wcm_ap_config_t *ap_conf, qstr opt, mp_obj_t opt_value, bool hold) { static bool required_ap_restart = false; @@ -743,7 +743,7 @@ STATIC void network_ap_set_config_param(cy_wcm_ap_config_t *ap_conf, qstr opt, m } } -STATIC void network_sta_set_config_param(network_ifx_wcm_sta_obj_t *sta_conf, qstr opt, mp_obj_t opt_value) { +static void network_sta_set_config_param(network_ifx_wcm_sta_obj_t *sta_conf, qstr opt, mp_obj_t opt_value) { switch (opt) { case MP_QSTR_channel: case MP_QSTR_key: @@ -764,7 +764,7 @@ STATIC void network_sta_set_config_param(network_ifx_wcm_sta_obj_t *sta_conf, qs } } -STATIC mp_obj_t network_ifx_wcm_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { +static mp_obj_t network_ifx_wcm_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) { network_ifx_wcm_obj_t *self = MP_OBJ_TO_PTR(args[0]); if (kwargs->used == 0) { @@ -806,12 +806,12 @@ STATIC mp_obj_t network_ifx_wcm_config(size_t n_args, const mp_obj_t *args, mp_m } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_ifx_wcm_config_obj, 1, network_ifx_wcm_config); +static MP_DEFINE_CONST_FUN_OBJ_KW(network_ifx_wcm_config_obj, 1, network_ifx_wcm_config); /*******************************************************************************/ // class bindings -STATIC const mp_rom_map_elem_t network_ifx_wcm_locals_dict_table[] = { +static const mp_rom_map_elem_t network_ifx_wcm_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&network_ifx_wcm_deinit_obj) }, // shall this be part of the module ?? { MP_ROM_QSTR(MP_QSTR_active), MP_ROM_PTR(&network_ifx_wcm_active_obj) }, { MP_ROM_QSTR(MP_QSTR_scan), MP_ROM_PTR(&network_ifx_wcm_scan_obj) }, @@ -832,7 +832,7 @@ STATIC const mp_rom_map_elem_t network_ifx_wcm_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_WPA2_WPA_PSK), MP_ROM_INT(NET_IFX_WCM_SEC_WPA_WPA2) }, { MP_ROM_QSTR(MP_QSTR_SEC_UNKNOWN), MP_ROM_INT(NET_IFX_WCM_SEC_UNKNOWN) }, }; -STATIC MP_DEFINE_CONST_DICT(network_ifx_wcm_locals_dict, network_ifx_wcm_locals_dict_table); +static MP_DEFINE_CONST_DICT(network_ifx_wcm_locals_dict, network_ifx_wcm_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( mp_network_ifx_wcm_type, diff --git a/ports/psoc6/psoc6_flash.c b/ports/psoc6/psoc6_flash.c index 8e1fa02af2d69..754de2df435fa 100644 --- a/ports/psoc6/psoc6_flash.c +++ b/ports/psoc6/psoc6_flash.c @@ -77,7 +77,7 @@ typedef struct _psoc6_flash_obj_t { uint32_t flash_size; } psoc6_flash_obj_t; -STATIC psoc6_flash_obj_t psoc6_flash_obj = { +static psoc6_flash_obj_t psoc6_flash_obj = { .base = { &psoc6_flash_type }, .flash_base = FLASH_BASE, .flash_size = FLASH_SIZE, @@ -113,7 +113,7 @@ void get_flash_info(void) { mplogger_print("\nPage size (bytes): %ld\n", page_size); } -STATIC mp_obj_t psoc6_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { +static mp_obj_t psoc6_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { mplogger_print("\nFlash constructor invoked\n"); #if MICROPY_LOGGER_DEBUG get_flash_info(); @@ -167,7 +167,7 @@ STATIC mp_obj_t psoc6_flash_make_new(const mp_obj_type_t *type, size_t n_args, s return MP_OBJ_FROM_PTR(self); } -STATIC mp_obj_t psoc6_flash_readblocks(size_t n_args, const mp_obj_t *args) { +static mp_obj_t psoc6_flash_readblocks(size_t n_args, const mp_obj_t *args) { mplogger_print("\nFlash readblocks called\n"); psoc6_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]); @@ -190,9 +190,9 @@ STATIC mp_obj_t psoc6_flash_readblocks(size_t n_args, const mp_obj_t *args) { return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(psoc6_flash_readblocks_obj, 3, 4, psoc6_flash_readblocks); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(psoc6_flash_readblocks_obj, 3, 4, psoc6_flash_readblocks); -STATIC mp_obj_t psoc6_flash_writeblocks(size_t n_args, const mp_obj_t *args) { +static mp_obj_t psoc6_flash_writeblocks(size_t n_args, const mp_obj_t *args) { mplogger_print("\nFlash writeblocks called\n"); psoc6_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]); uint32_t offset = mp_obj_get_int(args[1]) * BLOCK_SIZE_BYTES; @@ -229,9 +229,9 @@ STATIC mp_obj_t psoc6_flash_writeblocks(size_t n_args, const mp_obj_t *args) { MICROPY_END_ATOMIC_SECTION(atomic_state); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(psoc6_flash_writeblocks_obj, 3, 4, psoc6_flash_writeblocks); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(psoc6_flash_writeblocks_obj, 3, 4, psoc6_flash_writeblocks); -STATIC mp_obj_t psoc6_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) { +static mp_obj_t psoc6_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) { mplogger_print("Flash ioctrl called\n"); psoc6_flash_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_int_t cmd = mp_obj_get_int(cmd_in); @@ -265,14 +265,14 @@ STATIC mp_obj_t psoc6_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t ar return mp_const_none; } } -STATIC MP_DEFINE_CONST_FUN_OBJ_3(psoc6_flash_ioctl_obj, psoc6_flash_ioctl); +static MP_DEFINE_CONST_FUN_OBJ_3(psoc6_flash_ioctl_obj, psoc6_flash_ioctl); -STATIC const mp_rom_map_elem_t psoc6_flash_locals_dict_table[] = { +static const mp_rom_map_elem_t psoc6_flash_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&psoc6_flash_readblocks_obj) }, { MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&psoc6_flash_writeblocks_obj) }, { MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&psoc6_flash_ioctl_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(psoc6_flash_locals_dict, psoc6_flash_locals_dict_table); +static MP_DEFINE_CONST_DICT(psoc6_flash_locals_dict, psoc6_flash_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( psoc6_flash_type, diff --git a/ports/psoc6/psoc6_qspi_flash.c b/ports/psoc6/psoc6_qspi_flash.c index 5c060c58afb24..019ce718d19fd 100644 --- a/ports/psoc6/psoc6_qspi_flash.c +++ b/ports/psoc6/psoc6_qspi_flash.c @@ -65,7 +65,7 @@ typedef struct _psoc6_qspi_flash_obj_t { uint32_t flash_size; } psoc6_qspi_flash_obj_t; -STATIC psoc6_qspi_flash_obj_t psoc6_qspi_flash_obj = { +static psoc6_qspi_flash_obj_t psoc6_qspi_flash_obj = { .base = { &psoc6_qspi_flash_type }, .flash_base = EXT_FLASH_BASE, .flash_size = EXT_FLASH_SIZE, @@ -87,7 +87,7 @@ void get_ext_flash_info(void) { mplogger_print("\nPage size (bytes): %d\n", cy_serial_flash_qspi_get_prog_size(0x00)); } -STATIC mp_obj_t psoc6_qspi_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { +static mp_obj_t psoc6_qspi_flash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { mplogger_print("\nQSPI flash constructor invoked\n"); #if MICROPY_LOGGER_DEBUG get_ext_flash_info(); @@ -146,7 +146,7 @@ STATIC mp_obj_t psoc6_qspi_flash_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -STATIC mp_obj_t psoc6_qspi_flash_readblocks(size_t n_args, const mp_obj_t *args) { +static mp_obj_t psoc6_qspi_flash_readblocks(size_t n_args, const mp_obj_t *args) { mplogger_print("\nQSPI flash readblocks called\n"); psoc6_qspi_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]); @@ -169,9 +169,9 @@ STATIC mp_obj_t psoc6_qspi_flash_readblocks(size_t n_args, const mp_obj_t *args) ; return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(psoc6_qspi_flash_readblocks_obj, 3, 4, psoc6_qspi_flash_readblocks); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(psoc6_qspi_flash_readblocks_obj, 3, 4, psoc6_qspi_flash_readblocks); -STATIC mp_obj_t psoc6_qspi_flash_writeblocks(size_t n_args, const mp_obj_t *args) { +static mp_obj_t psoc6_qspi_flash_writeblocks(size_t n_args, const mp_obj_t *args) { mplogger_print("\nQSPI flash writeblocks called\n"); psoc6_qspi_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]); uint32_t offset = mp_obj_get_int(args[1]) * EXT_FLASH_BLOCK_SIZE_BYTES; @@ -208,9 +208,9 @@ STATIC mp_obj_t psoc6_qspi_flash_writeblocks(size_t n_args, const mp_obj_t *args MICROPY_END_ATOMIC_SECTION(atomic_state); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(psoc6_qspi_flash_writeblocks_obj, 3, 4, psoc6_qspi_flash_writeblocks); +static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(psoc6_qspi_flash_writeblocks_obj, 3, 4, psoc6_qspi_flash_writeblocks); -STATIC mp_obj_t psoc6_qspi_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) { +static mp_obj_t psoc6_qspi_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t arg_in) { mplogger_print("QSPI flash ioctrl called\n"); psoc6_qspi_flash_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_int_t cmd = mp_obj_get_int(cmd_in); @@ -250,14 +250,14 @@ STATIC mp_obj_t psoc6_qspi_flash_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj return mp_const_none; } } -STATIC MP_DEFINE_CONST_FUN_OBJ_3(psoc6_qspi_flash_ioctl_obj, psoc6_qspi_flash_ioctl); +static MP_DEFINE_CONST_FUN_OBJ_3(psoc6_qspi_flash_ioctl_obj, psoc6_qspi_flash_ioctl); -STATIC const mp_rom_map_elem_t psoc6_qspi_flash_locals_dict_table[] = { +static const mp_rom_map_elem_t psoc6_qspi_flash_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_readblocks), MP_ROM_PTR(&psoc6_qspi_flash_readblocks_obj) }, { MP_ROM_QSTR(MP_QSTR_writeblocks), MP_ROM_PTR(&psoc6_qspi_flash_writeblocks_obj) }, { MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&psoc6_qspi_flash_ioctl_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(psoc6_qspi_flash_locals_dict, psoc6_qspi_flash_locals_dict_table); +static MP_DEFINE_CONST_DICT(psoc6_qspi_flash_locals_dict, psoc6_qspi_flash_locals_dict_table); MP_DEFINE_CONST_OBJ_TYPE( psoc6_qspi_flash_type,