nrf/modmachine: Add machine.bootloader() and make it customisable.
This commit is contained in:
parent
0adf0dd3d7
commit
d8f5669532
|
@ -153,6 +153,13 @@ STATIC mp_obj_t machine_soft_reset(void) {
|
|||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(machine_soft_reset_obj, machine_soft_reset);
|
||||
|
||||
NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args) {
|
||||
MICROPY_BOARD_ENTER_BOOTLOADER(n_args, args);
|
||||
for (;;) {
|
||||
}
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_bootloader_obj, 0, 1, machine_bootloader);
|
||||
|
||||
STATIC mp_obj_t machine_lightsleep(void) {
|
||||
__WFE();
|
||||
return mp_const_none;
|
||||
|
@ -196,6 +203,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&machine_info_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_bootloader), MP_ROM_PTR(&machine_bootloader_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_enable_irq), MP_ROM_PTR(&machine_enable_irq_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_disable_irq), MP_ROM_PTR(&machine_disable_irq_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&machine_lightsleep_obj) },
|
||||
|
|
|
@ -38,5 +38,6 @@ MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(machine_info_obj);
|
|||
MP_DECLARE_CONST_FUN_OBJ_0(machine_reset_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(machine_lightsleep_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ_0(machine_deepsleep_obj);
|
||||
NORETURN mp_obj_t machine_bootloader(size_t n_args, const mp_obj_t *args);
|
||||
|
||||
#endif // __MICROPY_INCLUDED_NRF5_MODMACHINE_H__
|
||||
|
|
|
@ -371,6 +371,10 @@ extern const struct _mp_obj_module_t music_module;
|
|||
#define MICROPY_BOARD_STARTUP()
|
||||
#endif
|
||||
|
||||
#ifndef MICROPY_BOARD_ENTER_BOOTLOADER
|
||||
#define MICROPY_BOARD_ENTER_BOOTLOADER(nargs, args)
|
||||
#endif
|
||||
|
||||
#ifndef MICROPY_BOARD_EARLY_INIT
|
||||
#define MICROPY_BOARD_EARLY_INIT()
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue