diff options
| author | Carl Elkins <carl@elkins.me.uk> | 2019-07-08 02:08:39 +0100 |
|---|---|---|
| committer | Carl Elkins <carl@elkins.me.uk> | 2019-07-08 02:08:39 +0100 |
| commit | 64507207da5a5b0a32cf0f8d51d6ca324b7dec21 (patch) | |
| tree | 456ae963272c93c418c04d8cde222cd5be12b2c8 /ports | |
| parent | 69460b943b9c89693bb61bbb0c0ec74be26adb3b (diff) | |
Added conditional compilation around selection of TX pad candidates
Original code was correct for SAMD21
New code for SAMD51 only permits pad-0 for TX
Diffstat (limited to 'ports')
| -rw-r--r-- | ports/atmel-samd/common-hal/busio/UART.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ports/atmel-samd/common-hal/busio/UART.c b/ports/atmel-samd/common-hal/busio/UART.c index 10618d1ce..c32919365 100644 --- a/ports/atmel-samd/common-hal/busio/UART.c +++ b/ports/atmel-samd/common-hal/busio/UART.c @@ -88,11 +88,19 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, continue; } potential_sercom = sercom_insts[sercom_index]; - if (potential_sercom->USART.CTRLA.bit.ENABLE != 0 || +#ifdef SAMD21 + if (potential_sercom->USART.CTRLA.bit.ENABLE != 0 || !(tx->sercom[i].pad == 0 || tx->sercom[i].pad == 2)) { continue; } +#endif +#ifdef SAMD51 + if (potential_sercom->USART.CTRLA.bit.ENABLE != 0 || + !(tx->sercom[i].pad == 0)) { + continue; + } +#endif tx_pinmux = PINMUX(tx->number, (i == 0) ? MUX_C : MUX_D); tx_pad = tx->sercom[i].pad; if (rx == mp_const_none) { |
