41
41
//| def heap_caps_get_total_size() -> int:
42
42
//| """Return the total size of the ESP-IDF, which includes the CircuitPython heap."""
43
43
//| ...
44
+ //|
44
45
45
46
STATIC mp_obj_t espidf_heap_caps_get_total_size (void ) {
46
47
return MP_OBJ_NEW_SMALL_INT (heap_caps_get_total_size (MALLOC_CAP_8BIT ));
@@ -50,6 +51,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_total_size_obj, espidf_heap_caps_
50
51
//| def heap_caps_get_free_size() -> int:
51
52
//| """Return total free memory in the ESP-IDF heap."""
52
53
//| ...
54
+ //|
53
55
54
56
STATIC mp_obj_t espidf_heap_caps_get_free_size (void ) {
55
57
return MP_OBJ_NEW_SMALL_INT (heap_caps_get_free_size (MALLOC_CAP_8BIT ));
@@ -59,6 +61,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_free_size_obj, espidf_heap_caps_g
59
61
//| def heap_caps_get_largest_free_block() -> int:
60
62
//| """Return the size of largest free memory block in the ESP-IDF heap."""
61
63
//| ...
64
+ //|
62
65
63
66
STATIC mp_obj_t espidf_heap_caps_get_largest_free_block (void ) {
64
67
return MP_OBJ_NEW_SMALL_INT (heap_caps_get_largest_free_block (MALLOC_CAP_8BIT ));
@@ -70,6 +73,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_largest_free_block_obj, espidf_he
70
73
//|
71
74
//| This is necessary when upgrading from CircuitPython 6.3.0 or earlier to CircuitPython 7.0.0, because the
72
75
//| layout of data in nvs has changed. The old data will be lost when you perform this operation."""
76
+ //|
73
77
STATIC mp_obj_t espidf_erase_nvs (void ) {
74
78
ESP_ERROR_CHECK (nvs_flash_deinit ());
75
79
ESP_ERROR_CHECK (nvs_flash_erase ());
@@ -105,6 +109,7 @@ const mp_obj_type_t mp_type_espidf_IDFError = {
105
109
//| """Raised when an ESP IDF memory allocation fails."""
106
110
//|
107
111
//| ...
112
+ //|
108
113
NORETURN void mp_raise_espidf_MemoryError (void ) {
109
114
nlr_raise (mp_obj_new_exception (& mp_type_espidf_MemoryError ));
110
115
}
@@ -120,13 +125,15 @@ const mp_obj_type_t mp_type_espidf_MemoryError = {
120
125
121
126
//| def get_total_psram() -> int:
122
127
//| """Returns the number of bytes of psram detected, or 0 if psram is not present or not configured"""
128
+ //|
123
129
STATIC mp_obj_t espidf_get_total_psram (void ) {
124
130
return MP_OBJ_NEW_SMALL_INT (common_hal_espidf_get_total_psram ());
125
131
}
126
132
MP_DEFINE_CONST_FUN_OBJ_0 (espidf_get_total_psram_obj , espidf_get_total_psram );
127
133
128
134
//| def get_reserved_psram() -> int:
129
135
//| """Returns number of bytes of psram reserved for use by esp-idf, either a board-specific default value or the value defined in ``/.env``."""
136
+ //|
130
137
STATIC mp_obj_t espidf_get_reserved_psram (void ) {
131
138
return MP_OBJ_NEW_SMALL_INT (common_hal_espidf_get_reserved_psram ());
132
139
}
0 commit comments