summaryrefslogtreecommitdiffstatshomepage
path: root/ports/esp32/machine_timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'ports/esp32/machine_timer.c')
-rw-r--r--ports/esp32/machine_timer.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/ports/esp32/machine_timer.c b/ports/esp32/machine_timer.c
index aba3db1983..5e249e46e6 100644
--- a/ports/esp32/machine_timer.c
+++ b/ports/esp32/machine_timer.c
@@ -66,8 +66,8 @@ typedef struct _machine_timer_obj_t {
const mp_obj_type_t machine_timer_type;
-STATIC void machine_timer_disable(machine_timer_obj_t *self);
-STATIC mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
+static void machine_timer_disable(machine_timer_obj_t *self);
+static mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
void machine_timer_deinit_all(void) {
// Disable, deallocate and remove all timers from list
@@ -80,14 +80,14 @@ void machine_timer_deinit_all(void) {
}
}
-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 = self_in;
qstr mode = self->repeat ? MP_QSTR_PERIODIC : MP_QSTR_ONE_SHOT;
uint64_t period = self->period / (TIMER_SCALE / 1000); // convert to ms
mp_printf(print, "Timer(%u, mode=%q, period=%lu)", (self->group << 1) | self->index, mode, period);
}
-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);
mp_uint_t group = (mp_obj_get_int(args[0]) >> 1) & 1;
mp_uint_t index = mp_obj_get_int(args[0]) & 1;
@@ -121,7 +121,7 @@ STATIC mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args,
return self;
}
-STATIC void machine_timer_disable(machine_timer_obj_t *self) {
+static void machine_timer_disable(machine_timer_obj_t *self) {
if (self->hal_context.dev != NULL) {
// Disable the counter and alarm.
timer_ll_enable_counter(self->hal_context.dev, self->index, false);
@@ -138,7 +138,7 @@ STATIC void machine_timer_disable(machine_timer_obj_t *self) {
// referenced elsewhere
}
-STATIC void machine_timer_isr(void *self_in) {
+static void machine_timer_isr(void *self_in) {
machine_timer_obj_t *self = self_in;
uint32_t intr_status = timer_ll_get_intr_status(self->hal_context.dev);
@@ -153,7 +153,7 @@ STATIC void machine_timer_isr(void *self_in) {
}
}
-STATIC void machine_timer_enable(machine_timer_obj_t *self) {
+static void machine_timer_enable(machine_timer_obj_t *self) {
// Initialise the timer.
timer_hal_init(&self->hal_context, self->group, self->index);
timer_ll_enable_counter(self->hal_context.dev, self->index, false);
@@ -183,7 +183,7 @@ STATIC void machine_timer_enable(machine_timer_obj_t *self) {
timer_ll_enable_counter(self->hal_context.dev, self->index, true);
}
-STATIC mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, mp_uint_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, mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum {
ARG_mode,
ARG_callback,
@@ -230,26 +230,26 @@ STATIC mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, mp_uint_t n
return mp_const_none;
}
-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_disable(self_in);
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 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) {
return machine_timer_init_helper(args[0], 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_value(mp_obj_t self_in) {
+static mp_obj_t machine_timer_value(mp_obj_t self_in) {
machine_timer_obj_t *self = self_in;
uint64_t result = timer_ll_get_counter_value(self->hal_context.dev, self->index);
return MP_OBJ_NEW_SMALL_INT((mp_uint_t)(result / (TIMER_SCALE / 1000))); // value in ms
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_value_obj, machine_timer_value);
+static MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_value_obj, machine_timer_value);
-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_deinit), MP_ROM_PTR(&machine_timer_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_timer_init_obj) },
@@ -257,7 +257,7 @@ STATIC const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_ONE_SHOT), MP_ROM_INT(false) },
{ MP_ROM_QSTR(MP_QSTR_PERIODIC), MP_ROM_INT(true) },
};
-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,