summaryrefslogtreecommitdiff
path: root/ports/teensy/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'ports/teensy/timer.c')
-rw-r--r--ports/teensy/timer.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/ports/teensy/timer.c b/ports/teensy/timer.c
index 68dc965eb..4df247433 100644
--- a/ports/teensy/timer.c
+++ b/ports/teensy/timer.c
@@ -746,13 +746,14 @@ STATIC const mp_rom_map_elem_t pyb_timer_locals_dict_table[] = {
};
STATIC MP_DEFINE_CONST_DICT(pyb_timer_locals_dict, pyb_timer_locals_dict_table);
-const mp_obj_type_t pyb_timer_type = {
- { &mp_type_type },
- .name = MP_QSTR_Timer,
- .print = pyb_timer_print,
- .make_new = pyb_timer_make_new,
- .locals_dict = (mp_obj_t)&pyb_timer_locals_dict,
-};
+MP_DEFINE_CONST_OBJ_TYPE(
+ pyb_timer_type,
+ MP_QSTR_Timer,
+ MP_TYPE_FLAG_NONE,
+ pyb_timer_make_new,
+ print, pyb_timer_print,
+ locals_dict, (mp_obj_t)&pyb_timer_locals_dict
+ );
/// \moduleref pyb
/// \class TimerChannel - setup a channel for a timer.
@@ -889,12 +890,14 @@ STATIC const mp_rom_map_elem_t pyb_timer_channel_locals_dict_table[] = {
};
STATIC MP_DEFINE_CONST_DICT(pyb_timer_channel_locals_dict, pyb_timer_channel_locals_dict_table);
-STATIC const mp_obj_type_t pyb_timer_channel_type = {
- { &mp_type_type },
- .name = MP_QSTR_TimerChannel,
- .print = pyb_timer_channel_print,
- .locals_dict = (mp_obj_t)&pyb_timer_channel_locals_dict,
-};
+STATIC MP_DEFINE_CONST_OBJ_TYPE(
+ pyb_timer_channel_type,
+ MP_QSTR_TimerChannel,
+ MP_TYPE_FLAG_NONE,
+ MP_TYPE_NULL_MAKE_NEW,
+ print, pyb_timer_channel_print,
+ locals_dict, (mp_obj_t)&pyb_timer_channel_locals_dict
+ );
STATIC bool ftm_handle_irq_callback(pyb_timer_obj_t *self, mp_uint_t channel, mp_obj_t callback) {
// execute callback if it's set