mirror of
https://github.com/W3SLAV/micropython.git
synced 2025-06-20 12:35:34 -04:00
parent
19ea30bdd5
commit
8d34344dce
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "py/obj.h"
|
#include "py/obj.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
#include "lib/utils/pyexec.h"
|
||||||
|
|
||||||
// This needs to be set before we include the RTOS headers
|
// This needs to be set before we include the RTOS headers
|
||||||
#define USE_US_TIMER 1
|
#define USE_US_TIMER 1
|
||||||
@ -77,6 +78,12 @@ STATIC mp_obj_t machine_reset(void) {
|
|||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset);
|
||||||
|
|
||||||
|
STATIC mp_obj_t machine_soft_reset(void) {
|
||||||
|
pyexec_system_exit = PYEXEC_FORCED_EXIT;
|
||||||
|
mp_raise_type(&mp_type_SystemExit);
|
||||||
|
}
|
||||||
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_soft_reset_obj, machine_soft_reset);
|
||||||
|
|
||||||
STATIC mp_obj_t machine_reset_cause(void) {
|
STATIC mp_obj_t machine_reset_cause(void) {
|
||||||
return MP_OBJ_NEW_SMALL_INT(system_get_rst_info()->reason);
|
return MP_OBJ_NEW_SMALL_INT(system_get_rst_info()->reason);
|
||||||
}
|
}
|
||||||
@ -392,6 +399,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
|
|||||||
|
|
||||||
{ MP_ROM_QSTR(MP_QSTR_freq), MP_ROM_PTR(&machine_freq_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_freq), MP_ROM_PTR(&machine_freq_obj) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&machine_reset_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&machine_reset_obj) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_soft_reset), MP_ROM_PTR(&machine_soft_reset_obj) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_reset_cause), MP_ROM_PTR(&machine_reset_cause_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_reset_cause), MP_ROM_PTR(&machine_reset_cause_obj) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_unique_id), MP_ROM_PTR(&machine_unique_id_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_unique_id), MP_ROM_PTR(&machine_unique_id_obj) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_idle), MP_ROM_PTR(&machine_idle_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_idle), MP_ROM_PTR(&machine_idle_obj) },
|
||||||
|
Loading…
Reference in New Issue
Block a user