Skip to content
Snippets Groups Projects
Commit 890a9422 authored by swym's avatar swym
Browse files

feat(pycardium): add debug module

parent ca63c862
No related branches found
No related tags found
No related merge requests found
Pipeline #2948 passed
...@@ -13,7 +13,8 @@ modsrc = files( ...@@ -13,7 +13,8 @@ modsrc = files(
'modules/sys_display.c', 'modules/sys_display.c',
'modules/utime.c', 'modules/utime.c',
'modules/vibra.c', 'modules/vibra.c',
'modules/bme680.c' 'modules/bme680.c',
'modules/debug.c',
) )
################################# #################################
......
#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);
...@@ -142,3 +142,6 @@ Q(NO_CONTACT) ...@@ -142,3 +142,6 @@ Q(NO_CONTACT)
Q(CHAOS) Q(CHAOS)
Q(COMMUNICATION) Q(COMMUNICATION)
Q(CAMP) Q(CAMP)
/* debug */
Q(debug)
...@@ -56,6 +56,7 @@ int mp_hal_trng_read_int(void); ...@@ -56,6 +56,7 @@ int mp_hal_trng_read_int(void);
#define MODULE_PERSONAL_STATE_ENABLED (1) #define MODULE_PERSONAL_STATE_ENABLED (1)
#define MODULE_UTIME_ENABLED (1) #define MODULE_UTIME_ENABLED (1)
#define MODULE_VIBRA_ENABLED (1) #define MODULE_VIBRA_ENABLED (1)
#define MODULE_DEBUG_ENABLED (1)
/* /*
* This port is intended to be 32-bit, but unfortunately, int32_t for * This port is intended to be 32-bit, but unfortunately, int32_t for
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment