2015-10-14 03:46:18 -04:00
|
|
|
#include "py/mpconfig.h"
|
|
|
|
#include "py/obj.h"
|
|
|
|
#include "py/runtime.h"
|
|
|
|
#include "mperror.h"
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
2017-06-30 03:22:17 -04:00
|
|
|
// MicroPython bindings
|
2015-10-14 03:46:18 -04:00
|
|
|
|
2017-08-29 20:59:58 -04:00
|
|
|
STATIC mp_obj_t mod_wipy_heartbeat(size_t n_args, const mp_obj_t *args) {
|
2015-10-14 03:46:18 -04:00
|
|
|
if (n_args) {
|
|
|
|
mperror_enable_heartbeat (mp_obj_is_true(args[0]));
|
|
|
|
return mp_const_none;
|
|
|
|
} else {
|
|
|
|
return mp_obj_new_bool(mperror_is_heartbeat_enabled());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_wipy_heartbeat_obj, 0, 1, mod_wipy_heartbeat);
|
|
|
|
|
2017-08-21 07:34:23 -04:00
|
|
|
STATIC const mp_rom_map_elem_t wipy_module_globals_table[] = {
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_wipy) },
|
|
|
|
{ MP_ROM_QSTR(MP_QSTR_heartbeat), MP_ROM_PTR(&mod_wipy_heartbeat_obj) },
|
2015-10-14 03:46:18 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
STATIC MP_DEFINE_CONST_DICT(wipy_module_globals, wipy_module_globals_table);
|
|
|
|
|
|
|
|
const mp_obj_module_t wipy_module = {
|
|
|
|
.base = { &mp_type_module },
|
|
|
|
.globals = (mp_obj_dict_t*)&wipy_module_globals,
|
|
|
|
};
|
2022-04-20 07:33:45 -04:00
|
|
|
|
2022-05-31 08:56:11 -04:00
|
|
|
MP_REGISTER_MODULE(MP_QSTR_wipy, wipy_module);
|