Skip to content

Commit c00bde8

Browse files
committed
Update machine_timer.c
1 parent f5ffe43 commit c00bde8

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

ports/esp32/machine_timer.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ typedef struct _machine_timer_obj_t {
6767

6868
const mp_obj_type_t machine_timer_type;
6969

70-
STATIC void machine_timer_disable(machine_timer_obj_t *self);
71-
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);
70+
static void machine_timer_disable(machine_timer_obj_t *self);
71+
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);
7272

7373
void machine_timer_deinit_all(void) {
7474
// Disable, deallocate and remove all timers from list
@@ -81,14 +81,14 @@ void machine_timer_deinit_all(void) {
8181
}
8282
}
8383

84-
STATIC void machine_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
84+
static void machine_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
8585
machine_timer_obj_t *self = self_in;
8686
qstr mode = self->repeat ? MP_QSTR_PERIODIC : MP_QSTR_ONE_SHOT;
8787
uint64_t period = self->period / (TIMER_SCALE / 1000); // convert to ms
8888
mp_printf(print, "Timer(%u, mode=%q, period=%lu)", (self->group << 1) | self->index, mode, period);
8989
}
9090

91-
STATIC bool find_free_timer(mp_int_t *group, mp_int_t *index) {
91+
static bool find_free_timer(mp_int_t *group, mp_int_t *index) {
9292
// from highest to lowest id
9393
for (*group = SOC_TIMER_GROUPS - 1; *group >= 0; --(*group)) {
9494
for (*index = SOC_TIMER_GROUP_TIMERS_PER_GROUP - 1; *index >= 0; --(*index)) {
@@ -108,7 +108,7 @@ STATIC bool find_free_timer(mp_int_t *group, mp_int_t *index) {
108108
return false;
109109
}
110110

111-
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) {
111+
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) {
112112
mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true);
113113
mp_int_t group = (mp_obj_get_int(args[0]) >> 1) & 1;
114114
mp_int_t index = mp_obj_get_int(args[0]) & 1;
@@ -154,7 +154,7 @@ STATIC mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args,
154154
return self;
155155
}
156156

157-
STATIC void machine_timer_disable(machine_timer_obj_t *self) {
157+
static void machine_timer_disable(machine_timer_obj_t *self) {
158158
if (self->hal_context.dev != NULL) {
159159
// Disable the counter and alarm.
160160
timer_ll_enable_counter(self->hal_context.dev, self->index, false);
@@ -171,7 +171,7 @@ STATIC void machine_timer_disable(machine_timer_obj_t *self) {
171171
// referenced elsewhere
172172
}
173173

174-
STATIC void machine_timer_isr(void *self_in) {
174+
static void machine_timer_isr(void *self_in) {
175175
machine_timer_obj_t *self = self_in;
176176

177177
uint32_t intr_status = timer_ll_get_intr_status(self->hal_context.dev);
@@ -186,7 +186,7 @@ STATIC void machine_timer_isr(void *self_in) {
186186
}
187187
}
188188

189-
STATIC void machine_timer_enable(machine_timer_obj_t *self) {
189+
static void machine_timer_enable(machine_timer_obj_t *self) {
190190
// Initialise the timer.
191191
timer_hal_init(&self->hal_context, self->group, self->index);
192192
timer_ll_enable_counter(self->hal_context.dev, self->index, false);
@@ -216,7 +216,7 @@ STATIC void machine_timer_enable(machine_timer_obj_t *self) {
216216
timer_ll_enable_counter(self->hal_context.dev, self->index, true);
217217
}
218218

219-
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) {
219+
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) {
220220
enum {
221221
ARG_mode,
222222
ARG_callback,
@@ -263,34 +263,34 @@ STATIC mp_obj_t machine_timer_init_helper(machine_timer_obj_t *self, mp_uint_t n
263263
return mp_const_none;
264264
}
265265

266-
STATIC mp_obj_t machine_timer_deinit(mp_obj_t self_in) {
266+
static mp_obj_t machine_timer_deinit(mp_obj_t self_in) {
267267
machine_timer_disable(self_in);
268268

269269
return mp_const_none;
270270
}
271-
STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_deinit_obj, machine_timer_deinit);
271+
static MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_deinit_obj, machine_timer_deinit);
272272

273-
STATIC mp_obj_t machine_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
273+
static mp_obj_t machine_timer_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
274274
return machine_timer_init_helper(args[0], n_args - 1, args + 1, kw_args);
275275
}
276-
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_timer_init_obj, 1, machine_timer_init);
276+
static MP_DEFINE_CONST_FUN_OBJ_KW(machine_timer_init_obj, 1, machine_timer_init);
277277

278-
STATIC mp_obj_t machine_timer_value(mp_obj_t self_in) {
278+
static mp_obj_t machine_timer_value(mp_obj_t self_in) {
279279
machine_timer_obj_t *self = self_in;
280280
uint64_t result = timer_ll_get_counter_value(self->hal_context.dev, self->index);
281281
return MP_OBJ_NEW_SMALL_INT((mp_uint_t)(result / (TIMER_SCALE / 1000))); // value in ms
282282
}
283-
STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_value_obj, machine_timer_value);
283+
static MP_DEFINE_CONST_FUN_OBJ_1(machine_timer_value_obj, machine_timer_value);
284284

285-
STATIC const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
285+
static const mp_rom_map_elem_t machine_timer_locals_dict_table[] = {
286286
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&machine_timer_deinit_obj) },
287287
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_timer_deinit_obj) },
288288
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_timer_init_obj) },
289289
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&machine_timer_value_obj) },
290290
{ MP_ROM_QSTR(MP_QSTR_ONE_SHOT), MP_ROM_INT(false) },
291291
{ MP_ROM_QSTR(MP_QSTR_PERIODIC), MP_ROM_INT(true) },
292292
};
293-
STATIC MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table);
293+
static MP_DEFINE_CONST_DICT(machine_timer_locals_dict, machine_timer_locals_dict_table);
294294

295295
MP_DEFINE_CONST_OBJ_TYPE(
296296
machine_timer_type,

0 commit comments

Comments
 (0)