Skip to content

Commit a261026

Browse files
committed
Add UART support
1 parent 6f050d7 commit a261026

File tree

12 files changed

+261
-311
lines changed

12 files changed

+261
-311
lines changed

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,3 +243,12 @@ stubs:
243243
update-frozen-libraries:
244244
@echo "Updating all frozen libraries to latest tagged version."
245245
cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done
246+
247+
one-of-each: all-source
248+
make -C ports/atmel-samd BOARD=trinket_m0
249+
make -C ports/atmel-samd BOARD=feather_m4_express
250+
make -C ports/esp32s2 BOARD=espressif_saola_1_wroom
251+
make -C ports/litex BOARD=fomu
252+
make -C ports/mimxrt10xx BOARD=feather_mimxrt1011
253+
make -C ports/nrf BOARD=feather_nrf52840_express
254+
make -C ports/stm BOARD=feather_stm32f405_express

ports/atmel-samd/common-hal/busio/UART.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
5858
const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx,
5959
const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts,
6060
const mcu_pin_obj_t * rs485_dir, bool rs485_invert,
61-
uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop,
61+
uint32_t baudrate, uint8_t bits, busio_uart_parity_t parity, uint8_t stop,
6262
mp_float_t timeout, uint16_t receiver_buffer_size, byte* receiver_buffer,
6363
bool sigint_enabled) {
6464

@@ -195,7 +195,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
195195
SERCOM_USART_CTRLA_FORM_Msk);
196196
sercom->USART.CTRLA.reg |= SERCOM_USART_CTRLA_TXPO(tx_pad / 2) |
197197
SERCOM_USART_CTRLA_RXPO(rx_pad) |
198-
(parity == PARITY_NONE ? 0 : SERCOM_USART_CTRLA_FORM(1));
198+
(parity == BUSIO_UART_PARITY_NONE ? 0 : SERCOM_USART_CTRLA_FORM(1));
199199

200200
// Enable tx and/or rx based on whether the pins were specified.
201201
// CHSIZE is 0 for 8 bits, 5, 6, 7 for 5, 6, 7 bits. 1 for 9 bits, but we don't support that.
@@ -206,7 +206,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
206206
SERCOM_USART_CTRLB_CHSIZE_Msk);
207207
sercom->USART.CTRLB.reg |= (have_tx ? SERCOM_USART_CTRLB_TXEN : 0) |
208208
(have_rx ? SERCOM_USART_CTRLB_RXEN : 0) |
209-
(parity == PARITY_ODD ? SERCOM_USART_CTRLB_PMODE : 0) |
209+
(parity == BUSIO_UART_PARITY_ODD ? SERCOM_USART_CTRLB_PMODE : 0) |
210210
(stop > 1 ? SERCOM_USART_CTRLB_SBMODE : 0) |
211211
SERCOM_USART_CTRLB_CHSIZE(bits % 8);
212212

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
5656
const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx,
5757
const mcu_pin_obj_t * rts, const mcu_pin_obj_t * cts,
5858
const mcu_pin_obj_t * rs485_dir, bool rs485_invert,
59-
uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop,
59+
uint32_t baudrate, uint8_t bits, busio_uart_parity_t parity, uint8_t stop,
6060
mp_float_t timeout, uint16_t receiver_buffer_size, byte* receiver_buffer,
6161
bool sigint_enabled) {
6262
struct termios tio;
@@ -69,7 +69,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
6969
mp_raise_ValueError(translate("Could not initialize UART"));
7070
}
7171

72-
if (parity != PARITY_NONE) {
72+
if (parity != BUSIO_UART_PARITY_NONE) {
7373
mp_raise_ValueError(translate("Could not initialize UART"));
7474
}
7575

0 commit comments

Comments
 (0)