-
Notifications
You must be signed in to change notification settings - Fork 149
MCUs: update deprecated use of term_from_int32 #2241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release-0.7
Are you sure you want to change the base?
Changes from all commits
1fc676f
067805f
759d784
790fc03
c5a0911
1066bf6
9d2a026
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -546,25 +546,28 @@ term sys_get_info(Context *ctx, term key) | |
| { | ||
| GlobalContext *glb = ctx->global; | ||
| if (key == globalcontext_make_atom(glb, esp_free_heap_size_atom)) { | ||
| return term_from_int32(esp_get_free_heap_size()); | ||
| return term_from_int28(esp_get_free_heap_size()); | ||
| } | ||
| if (key == globalcontext_make_atom(glb, esp_largest_free_block_atom)) { | ||
| return term_from_int32(heap_caps_get_largest_free_block(MALLOC_CAP_DEFAULT)); | ||
| return term_from_int28(heap_caps_get_largest_free_block(MALLOC_CAP_DEFAULT)); | ||
| } | ||
| if (key == globalcontext_make_atom(glb, esp_get_minimum_free_size_atom)) { | ||
| return term_from_int32(esp_get_minimum_free_heap_size()); | ||
| return term_from_int28(esp_get_minimum_free_heap_size()); | ||
| } | ||
| if (key == globalcontext_make_atom(glb, esp_chip_info_atom)) { | ||
| esp_chip_info_t info; | ||
| esp_chip_info(&info); | ||
| if (memory_ensure_free(ctx, term_map_size_in_terms(4) + 4 * 2) != MEMORY_GC_OK) { | ||
| return OUT_OF_MEMORY_ATOM; | ||
| } | ||
|
|
||
| term ret = term_alloc_map(4, &ctx->heap); | ||
| term_set_map_assoc(ret, 0, globalcontext_make_atom(glb, cores_atom), term_from_int32(info.cores)); | ||
| _Static_assert(SOC_CPU_CORES_NUM <= 7, "core count may exceed term_from_int4 range"); | ||
| term_set_map_assoc(ret, 0, globalcontext_make_atom(glb, cores_atom), term_from_int4(info.cores)); | ||
| term_set_map_assoc(ret, 1, globalcontext_make_atom(glb, features_atom), get_features(ctx, info.features)); | ||
| term_set_map_assoc(ret, 2, globalcontext_make_atom(glb, model_atom), get_model(ctx, info.model)); | ||
| term_set_map_assoc(ret, 3, globalcontext_make_atom(glb, revision_atom), term_from_int32(info.revision)); | ||
| _Static_assert(CONFIG_ESP_REV_MAX_FULL <= 1023, "chip revision may not fit in term_from_int11"); | ||
| term_set_map_assoc(ret, 3, globalcontext_make_atom(glb, revision_atom), term_from_int11(info.revision)); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add something like:
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great idea, it will likely be many years (if ever) before these need to be updated, and this could end up slipping past unnoticed. |
||
| return ret; | ||
| } | ||
| if (key == globalcontext_make_atom(glb, esp_idf_version_atom)) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All values encoded in
adc_driver.cwithterm_from_int28are 17 bits or less.