Skip to content

Commit e755bd4

Browse files
committed
nrf/uart: Fix UART.writechar() to write just 1 byte.
1 parent 60a0548 commit e755bd4

File tree

1 file changed

+2
-6
lines changed
  • ports/nrf/modules/machine

1 file changed

+2
-6
lines changed

ports/nrf/modules/machine/uart.c

+2-6
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,9 @@ STATIC mp_obj_t machine_hard_uart_writechar(mp_obj_t self_in, mp_obj_t char_in)
245245
machine_hard_uart_obj_t *self = self_in;
246246

247247
// get the character to write (might be 9 bits)
248-
uint16_t data = mp_obj_get_int(char_in);
249-
250-
nrfx_err_t err = NRFX_SUCCESS;
251-
for (int i = 0; i < 2; i++) {
252-
err = uart_tx_char(self, (int)(&data)[i]);
253-
}
248+
int data = mp_obj_get_int(char_in);
254249

250+
nrfx_err_t err = uart_tx_char(self, data);
255251
if (err != NRFX_SUCCESS) {
256252
mp_hal_raise(err);
257253
}

0 commit comments

Comments
 (0)