esp8266: Move pyb.hard_reset() to machine.reset().
This commit is contained in:
parent
1b811b946e
commit
81fd5685fc
|
@ -57,6 +57,12 @@ STATIC mp_obj_t machine_freq(mp_uint_t n_args, const mp_obj_t *args) {
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_freq_obj, 0, 1, machine_freq);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_freq_obj, 0, 1, machine_freq);
|
||||||
|
|
||||||
|
STATIC mp_obj_t machine_reset(void) {
|
||||||
|
system_restart();
|
||||||
|
return mp_const_none;
|
||||||
|
}
|
||||||
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset);
|
||||||
|
|
||||||
typedef struct _esp_timer_obj_t {
|
typedef struct _esp_timer_obj_t {
|
||||||
mp_obj_base_t base;
|
mp_obj_base_t base;
|
||||||
os_timer_t timer;
|
os_timer_t timer;
|
||||||
|
@ -139,6 +145,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_mem32), MP_ROM_PTR(&machine_mem32_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_mem32), MP_ROM_PTR(&machine_mem32_obj) },
|
||||||
|
|
||||||
{ 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_Timer), MP_ROM_PTR(&esp_timer_type) },
|
{ MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&esp_timer_type) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&pyb_pin_type) },
|
{ MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&pyb_pin_type) },
|
||||||
|
|
|
@ -125,12 +125,6 @@ STATIC mp_obj_t pyb_udelay(mp_obj_t usec_in) {
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_udelay_obj, pyb_udelay);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_udelay_obj, pyb_udelay);
|
||||||
|
|
||||||
STATIC mp_obj_t pyb_hard_reset(void) {
|
|
||||||
system_restart();
|
|
||||||
return mp_const_none;
|
|
||||||
}
|
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_hard_reset_obj, pyb_hard_reset);
|
|
||||||
|
|
||||||
STATIC mp_obj_t pyb_unique_id(void) {
|
STATIC mp_obj_t pyb_unique_id(void) {
|
||||||
uint32_t id = system_get_chip_id();
|
uint32_t id = system_get_chip_id();
|
||||||
return mp_obj_new_bytes((byte *)&id, sizeof(id));
|
return mp_obj_new_bytes((byte *)&id, sizeof(id));
|
||||||
|
@ -149,7 +143,6 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = {
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_delay), (mp_obj_t)&pyb_delay_obj },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_delay), (mp_obj_t)&pyb_delay_obj },
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_udelay), (mp_obj_t)&pyb_udelay_obj },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_udelay), (mp_obj_t)&pyb_udelay_obj },
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_sync), (mp_obj_t)&pyb_sync_obj },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_sync), (mp_obj_t)&pyb_sync_obj },
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_hard_reset), (mp_obj_t)&pyb_hard_reset_obj },
|
|
||||||
|
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_Pin), (mp_obj_t)&pyb_pin_type },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_Pin), (mp_obj_t)&pyb_pin_type },
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_ADC), (mp_obj_t)&pyb_adc_type },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_ADC), (mp_obj_t)&pyb_adc_type },
|
||||||
|
|
|
@ -39,7 +39,6 @@ Q(elapsed_micros)
|
||||||
Q(delay)
|
Q(delay)
|
||||||
Q(udelay)
|
Q(udelay)
|
||||||
Q(sync)
|
Q(sync)
|
||||||
Q(hard_reset)
|
|
||||||
Q(unique_id)
|
Q(unique_id)
|
||||||
|
|
||||||
// uos module
|
// uos module
|
||||||
|
@ -191,6 +190,7 @@ Q(ticks_diff)
|
||||||
Q(time)
|
Q(time)
|
||||||
|
|
||||||
// machine
|
// machine
|
||||||
|
Q(reset)
|
||||||
Q(Timer)
|
Q(Timer)
|
||||||
Q(callback)
|
Q(callback)
|
||||||
Q(deinit)
|
Q(deinit)
|
||||||
|
|
Loading…
Reference in New Issue