esp8266/modesp: Add freemem() and meminfo() functions.
They call into vendor SDK functions system_get_free_heap_size() and system_print_meminfo() respectively.
This commit is contained in:
parent
c734de490a
commit
1cc81ed449
|
@ -617,6 +617,17 @@ STATIC mp_obj_t esp_neopixel_write_(mp_obj_t pin, mp_obj_t buf, mp_obj_t is800k)
|
|||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp_neopixel_write_obj, esp_neopixel_write_);
|
||||
|
||||
STATIC mp_obj_t esp_freemem() {
|
||||
return MP_OBJ_NEW_SMALL_INT(system_get_free_heap_size());
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_freemem_obj, esp_freemem);
|
||||
|
||||
STATIC mp_obj_t esp_meminfo() {
|
||||
system_print_meminfo();
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_meminfo_obj, esp_meminfo);
|
||||
|
||||
STATIC const mp_map_elem_t esp_module_globals_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_esp) },
|
||||
|
||||
|
@ -632,6 +643,8 @@ STATIC const mp_map_elem_t esp_module_globals_table[] = {
|
|||
{ MP_OBJ_NEW_QSTR(MP_QSTR_getaddrinfo), (mp_obj_t)&esp_getaddrinfo_obj },
|
||||
#endif
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_neopixel_write), (mp_obj_t)&esp_neopixel_write_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_freemem), (mp_obj_t)&esp_freemem_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_meminfo), (mp_obj_t)&esp_meminfo_obj },
|
||||
|
||||
#if MODESP_INCLUDE_CONSTANTS
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SLEEP_NONE),
|
||||
|
|
|
@ -69,6 +69,8 @@ Q(flash_read)
|
|||
Q(flash_write)
|
||||
Q(flash_erase)
|
||||
Q(sdk_version)
|
||||
Q(freemem)
|
||||
Q(meminfo)
|
||||
Q(getaddrinfo)
|
||||
Q(send)
|
||||
Q(sendto)
|
||||
|
|
Loading…
Reference in New Issue