debug.c 882 Bytes
Newer Older
swym's avatar
swym committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "epicardium.h"

#include "py/obj.h"
#include "py/runtime.h"

static mp_obj_t mp_debug_fs_status()
{
	int rc = epic_file_fs_status();
	if (rc < 0) {
		mp_raise_OSError(-rc);
	}
	return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_0(fs_status_obj, mp_debug_fs_status);

static const mp_rom_map_elem_t debug_module_globals_table[] = {
	{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_debug) },
	{ MP_ROM_QSTR(MP_QSTR_fs_status), MP_ROM_PTR(&fs_status_obj) },
};

static MP_DEFINE_CONST_DICT(debug_module_globals, debug_module_globals_table);

// Define module object.
const mp_obj_module_t debug_module = {
	.base    = { &mp_type_module },
	.globals = (mp_obj_dict_t *)&debug_module_globals,
};

/* This is a special macro that will make MicroPython aware of this module */
/* clang-format off */
MP_REGISTER_MODULE(MP_QSTR_debug, debug_module, MODULE_DEBUG_ENABLED);