10000 Apply suggestions from code review · cezer-io/circuitpython@a2ad339 · GitHub
[go: up one dir, main page]

Skip to content

Commit a2ad339

Browse files
Sola85dhalbert
andauthored
Apply suggestions from code review
Co-authored-by: Dan Halbert <halbert@halwitz.org>
1 parent dde4a40 commit a2ad339

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ports/espressif/common-hal/pulseio/PulseIn.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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 *)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);
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-
heap_caps_free(self->raw_symbols);
119+
port_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-
heap_caps_free(self->raw_symbols);
130+
port_free(self->raw_symbols);
131131
raise_esp_error(result);
132132
}
133133
}

0 commit comments

Comments
 (0)
0