utime.c 1.16 KB
Newer Older
Rahix's avatar
Rahix committed
1
2
3
4
5
6
#include "py/mpconfig.h"
#include "extmod/utime_mphal.h"

#include "mxc_delay.h"

static const mp_rom_map_elem_t time_module_globals_table[] = {
Rahix's avatar
Rahix committed
7
8
9
10
	{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_utime) },
	{ MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&mp_utime_sleep_obj) },
	{ MP_ROM_QSTR(MP_QSTR_sleep_ms), MP_ROM_PTR(&mp_utime_sleep_ms_obj) },
	{ MP_ROM_QSTR(MP_QSTR_sleep_us), MP_ROM_PTR(&mp_utime_sleep_us_obj) },
Rahix's avatar
Rahix committed
11
12
13
14
15
16
17
18
19
20
21
22
#if 0
	/* TODO: Implement those */
	{MP_ROM_QSTR(MP_QSTR_ticks_ms), MP_ROM_PTR(&mp_utime_ticks_ms_obj)},
	{MP_ROM_QSTR(MP_QSTR_ticks_us), MP_ROM_PTR(&mp_utime_ticks_us_obj)},
	{MP_ROM_QSTR(MP_QSTR_ticks_cpu), MP_ROM_PTR(&mp_utime_ticks_cpu_obj)},
	{MP_ROM_QSTR(MP_QSTR_ticks_add), MP_ROM_PTR(&mp_utime_ticks_add_obj)},
	{MP_ROM_QSTR(MP_QSTR_ticks_diff), MP_ROM_PTR(&mp_utime_ticks_diff_obj)},
#endif
};
static MP_DEFINE_CONST_DICT(time_module_globals, time_module_globals_table);

const mp_obj_module_t mp_module_utime = {
Rahix's avatar
Rahix committed
23
	.base    = { &mp_type_module },
Rahix's avatar
Rahix committed
24
	.globals = (mp_obj_dict_t *)&time_module_globals,
Rahix's avatar
Rahix committed
25
26
27
};

/* Register the module to make it available in Python */
28
/* clang-format off */
Rahix's avatar
Rahix committed
29
MP_REGISTER_MODULE(MP_QSTR_utime, mp_module_utime, MODULE_UTIME_ENABLED);