@@ -77,19 +77,19 @@ static framesize_t get_frame_size(Context *ctx, term frame_size)
77
77
{
78
78
if (term_is_nil (frame_size )) {
79
79
return FRAMESIZE_XGA ;
80
- } else if (frame_size == context_make_atom (ctx , qvga_a )) {
80
+ } else if (frame_size == globalcontext_make_atom (ctx -> global , qvga_a )) {
81
81
return FRAMESIZE_QVGA ;
82
- } else if (frame_size == context_make_atom (ctx , cif_a )) {
82
+ } else if (frame_size == globalcontext_make_atom (ctx -> global , cif_a )) {
83
83
return FRAMESIZE_CIF ;
84
- } else if (frame_size == context_make_atom (ctx , vga_a )) {
84
+ } else if (frame_size == globalcontext_make_atom (ctx -> global , vga_a )) {
85
85
return FRAMESIZE_VGA ;
86
- } else if (frame_size == context_make_atom (ctx , svga_a )) {
86
+ } else if (frame_size == globalcontext_make_atom (ctx -> global , svga_a )) {
87
87
return FRAMESIZE_SVGA ;
88
- } else if (frame_size == context_make_atom (ctx , xga_a )) {
88
+ } else if (frame_size == globalcontext_make_atom (ctx -> global , xga_a )) {
89
89
return FRAMESIZE_XGA ;
90
- } else if (frame_size == context_make_atom (ctx , sxga_a )) {
90
+ } else if (frame_size == globalcontext_make_atom (ctx -> global , sxga_a )) {
91
91
return FRAMESIZE_SXGA ;
92
- } else if (frame_size == context_make_atom (ctx , uxga_a )) {
92
+ } else if (frame_size == globalcontext_make_atom (ctx -> global , uxga_a )) {
93
93
return FRAMESIZE_UXGA ;
94
94
} else {
95
95
return FRAMESIZE_INVALID ;
@@ -123,8 +123,8 @@ static camera_config_t *create_camera_config(framesize_t frame_size, int jpeg_qu
123
123
config -> pin_pwdn = AI_THINKER_CAM_PIN_PWDN ;
124
124
config -> pin_reset = AI_THINKER_CAM_PIN_RESET ;
125
125
config -> pin_xclk = AI_THINKER_CAM_PIN_XCLK ;
126
- config -> pin_sscb_sda = AI_THINKER_CAM_PIN_SIOD ;
127
- config -> pin_sscb_scl = AI_THINKER_CAM_PIN_SIOC ;
126
+ config -> pin_sccb_sda = AI_THINKER_CAM_PIN_SIOD ;
127
+ config -> pin_sccb_scl = AI_THINKER_CAM_PIN_SIOC ;
128
128
config -> pin_d7 = AI_THINKER_CAM_PIN_D7 ;
129
129
config -> pin_d6 = AI_THINKER_CAM_PIN_D6 ;
130
130
config -> pin_d5 = AI_THINKER_CAM_PIN_D5 ;
@@ -158,13 +158,13 @@ static term nif_esp32cam_init(Context *ctx, int argc, term argv[])
158
158
config = argv [0 ];
159
159
}
160
160
161
- framesize_t frame_size = get_frame_size (ctx , interop_proplist_get_value (config , context_make_atom (ctx , frame_size_a )));
161
+ framesize_t frame_size = get_frame_size (ctx , interop_proplist_get_value (config , globalcontext_make_atom (ctx -> global , frame_size_a )));
162
162
if (frame_size == FRAMESIZE_INVALID ) {
163
163
ESP_LOGE (TAG , "Invalid frame_size=%i" , frame_size );
164
164
RAISE_ERROR (BADARG_ATOM );
165
165
}
166
166
TRACE ("frame_size: %i\n" , frame_size );
167
- int jpeg_quality = get_jpeg_quality (interop_proplist_get_value (config , context_make_atom (ctx , jpeg_quality_a )));
167
+ int jpeg_quality = get_jpeg_quality (interop_proplist_get_value (config , globalcontext_make_atom (ctx -> global , jpeg_quality_a )));
168
168
if (jpeg_quality == INVALID_JPEG_QUALITY ) {
169
169
ESP_LOGE (TAG , "Invalid jpeg_quality=%i" , jpeg_quality );
170
170
RAISE_ERROR (BADARG_ATOM );
@@ -203,7 +203,7 @@ static term nif_esp32cam_capture(Context *ctx, int argc, term argv[])
203
203
204
204
if (!camera_initialized ) {
205
205
ESP_LOGE (TAG , "Camera not initialized! Bad state." );
206
- RAISE_ERROR (context_make_atom (ctx , bad_state_a ));
206
+ RAISE_ERROR (globalcontext_make_atom (ctx -> global , bad_state_a ));
207
207
}
208
208
209
209
uint8_t use_flash = 0 ;
@@ -214,7 +214,7 @@ static term nif_esp32cam_capture(Context *ctx, int argc, term argv[])
214
214
if (UNLIKELY (memory_ensure_free (ctx , 3 ) != MEMORY_GC_OK )) {
215
215
RAISE_ERROR (MEMORY_ATOM );
216
216
}
217
- term error = port_create_error_tuple (ctx , context_make_atom (ctx , capture_failed_a ));
217
+ term error = port_create_error_tuple (ctx , globalcontext_make_atom (ctx -> global , capture_failed_a ));
218
218
return error ;
219
219
}
220
220
@@ -223,7 +223,7 @@ static term nif_esp32cam_capture(Context *ctx, int argc, term argv[])
223
223
ESP_LOGE (TAG , "Image memory allocation (%i) failed" , fb -> len );
224
224
RAISE_ERROR (MEMORY_ATOM );
225
225
}
226
- term image = term_from_literal_binary ((const char * )fb -> buf , fb -> len , ctx );
226
+ term image = term_from_literal_binary ((const char * )fb -> buf , fb -> len , & ctx -> heap , ctx -> global );
227
227
esp_camera_fb_return (fb );
228
228
229
229
return port_create_tuple2 (ctx , OK_ATOM , image );
@@ -271,5 +271,5 @@ const struct Nif *atomvm_esp32cam_get_nif(const char *nifname)
271
271
272
272
#include <sdkconfig.h>
273
273
#ifdef CONFIG_AVM_ESP32CAM_ENABLE
274
- REGISTER_NIF_COLLECTION (atomvm_esp32cam , atomvm_esp32cam_init , atomvm_esp32cam_get_nif )
274
+ REGISTER_NIF_COLLECTION (atomvm_esp32cam , atomvm_esp32cam_init , NULL , atomvm_esp32cam_get_nif )
275
275
#endif
0 commit comments