Skip to content

Commit e681c44

Browse files
committed
Minor changes in ports/analog/ busio UART.
- Use m_malloc_without_collect storage API change from CircuitPython - Remove err number for asynchronous read error; just report it Signed-off-by: Brandon-Hurst <[email protected]>
1 parent bb0529b commit e681c44

File tree

1 file changed

+2
-6
lines changed
  • ports/analog/common-hal/busio

1 file changed

+2
-6
lines changed

ports/analog/common-hal/busio/UART.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,8 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
197197
self->rx_pin = rx;
198198
common_hal_mcu_pin_claim(self->tx_pin);
199199
common_hal_mcu_pin_claim(self->rx_pin);
200-
} else if (tx != NULL) {
201-
mp_raise_NotImplementedError(MP_ERROR_TEXT("UART needs TX & RX"));
202-
} else if (rx != NULL) {
203-
mp_raise_NotImplementedError(MP_ERROR_TEXT("UART needs TX & RX"));
204200
} else {
205-
// Should not get here, as shared-bindings API should not call this way
201+
mp_raise_NotImplementedError(MP_ERROR_TEXT("UART needs TX & RX"));
206202
}
207203

208204
if ((cts) && (rts)) {
@@ -243,7 +239,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
243239

244240
// Initialize ringbuffer
245241
if (receiver_buffer == NULL) {
246-
self->ringbuf = gc_alloc(receiver_buffer_size, false);
242+
self->ringbuf = m_malloc_without_collect(receiver_buffer_size, false);
247243
if (!ringbuf_alloc(self->ringbuf, receiver_buffer_size)) {
248244
m_malloc_fail(receiver_buffer_size);
249245
mp_raise_RuntimeError(MP_ERROR_TEXT("ERR: Could not init ringbuffer\n"));

0 commit comments

Comments
 (0)