@@ -82,7 +82,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu
8282 // captured because we may skip the first portion of a symbol.
8383 self -> raw_symbols_size = (maxlen / 2 + 1 ) * sizeof (rmt_symbol_word_t );
8484 // RMT DMA mode cannot access PSRAM -> ensure raw_symbols is in internal ram
85- self -> raw_symbols = (rmt_symbol_word_t * )port_malloc (self -> raw_symbols_size , true );
85+ self -> raw_symbols = (rmt_symbol_word_t * )heap_caps_malloc (self -> raw_symbols_size , MALLOC_CAP_INTERNAL );
8686 if (self -> raw_symbols == NULL ) {
8787 m_free (self -> buffer );
8888 m_malloc_fail (self -> raw_symbols_size );
@@ -116,7 +116,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu
116116 // If we fail here, the self->buffer will be garbage collected.
117117 esp_err_t result = rmt_new_rx_channel (& config , & self -> channel );
118118 if (result != ESP_OK ) {
119- port_free (self -> raw_symbols );
119+ heap_caps_free (self -> raw_symbols );
120120 raise_esp_error (result );
121121 }
122122
@@ -127,7 +127,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu
127127 rmt_enable (self -> channel );
128128 result = rmt_receive (self -> channel , self -> raw_symbols , self -> raw_symbols_size , & rx_config );
129129 if (result != ESP_OK ) {
130- port_free (self -> raw_symbols );
130+ heap_caps_free (self -> raw_symbols );
131131 raise_esp_error (result );
132132 }
133133}
0 commit comments