@@ -82,7 +82,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu
82
82
// captured because we may skip the first portion of a symbol.
83
83
self -> raw_symbols_size = (maxlen / 2 + 1 ) * sizeof (rmt_symbol_word_t );
84
84
// RMT DMA mode cannot access PSRAM -> ensure raw_symbols is in internal ram
85
- self -> raw_symbols = (rmt_symbol_word_t * )heap_caps_malloc (self -> raw_symbols_size , MALLOC_CAP_INTERNAL );
85
+ self -> raw_symbols = (rmt_symbol_word_t * )port_malloc (self -> raw_symbols_size , true );
86
86
if (self -> raw_symbols == NULL ) {
87
87
m_free (self -> buffer );
88
88
m_malloc_fail (self -> raw_symbols_size );
@@ -116,7 +116,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu
116
116
// If we fail here, the self->buffer will be garbage collected.
117
117
esp_err_t result = rmt_new_rx_channel (& config , & self -> channel );
118
118
if (result != ESP_OK ) {
119
- heap_caps_free (self -> raw_symbols );
119
+ port_free (self -> raw_symbols );
120
120
raise_esp_error (result );
121
121
}
122
122
@@ -127,7 +127,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu
127
127
rmt_enable (self -> channel );
128
128
result = rmt_receive (self -> channel , self -> raw_symbols , self -> raw_symbols_size , & rx_config );
129
129
if (result != ESP_OK ) {
130
- heap_caps_free (self -> raw_symbols );
130
+ port_free (self -> raw_symbols );
131
131
raise_esp_error (result );
132
132
}
133
133
}
0 commit comments