Edits as a result of review

crypto-aes
Dave Marples 3 years ago
parent 490a808bf6
commit 24405cabaf
  1. 2
      ports/atmel-samd/common-hal/busio/UART.c
  2. 2
      ports/cxd56/common-hal/busio/UART.c
  3. 37
      ports/mimxrt10xx/common-hal/busio/UART.c
  4. 4
      ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h
  5. 4
      ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h
  6. 2
      ports/nrf/common-hal/busio/UART.c

@ -65,7 +65,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
uint32_t tx_pinmux = 0;
uint8_t tx_pad = 255; // Unset pad
if ((rts != mp_const_none) || (cts != mp_const_none) || (rs485_dir != mp_const_none) || (rs485_invert == true)) {
if ((rts != mp_const_none) || (cts != mp_const_none) || (rs485_dir != mp_const_none) || (rs485_invert)) {
mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device"));
}

@ -60,7 +60,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
mp_float_t timeout, uint16_t receiver_buffer_size) {
struct termios tio;
if ((rts != mp_const_none) || (cts != mp_const_none) || (rs485_dir != mp_const_none) || (rs485_invert == true)) {
if ((rts != mp_const_none) || (cts != mp_const_none) || (rs485_dir != mp_const_none) || (rs485_invert)) {
mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device"));
}

@ -123,41 +123,38 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
// For IMXRT the RTS pin is used for RS485 direction
rts = rs485_dir;
}
else
{
if (rs485_invert == true) {
mp_raise_ValueError(translate("RS485 inversion specified when not in RS485 mode"));
}
else {
if (rs485_invert) {
mp_raise_ValueError(translate("RS485 inversion specified when not in RS485 mode"));
}
}
// Now check for RTS/CTS (or overloaded RS485 direction) pin(s)
const uint32_t rts_count = sizeof(mcu_uart_rts_list) / sizeof(mcu_periph_obj_t);
const uint32_t cts_count = sizeof(mcu_uart_cts_list) / sizeof(mcu_periph_obj_t);
if (rts != mp_const_none) {
for (uint32_t i=0; i < rts_count; ++i)
{
if (mcu_uart_rts_list[i].bank_idx == self->rx_pin->bank_idx) {
if (mcu_uart_rts_list[i].pin == rts) {
self->rts_pin = &mcu_uart_rts_list[i];
break;
}
for (uint32_t i=0; i < rts_count; ++i) {
if (mcu_uart_rts_list[i].bank_idx == self->rx_pin->bank_idx) {
if (mcu_uart_rts_list[i].pin == rts) {
self->rts_pin = &mcu_uart_rts_list[i];
break;
}
}
}
if (self->rts_pin == NULL)
mp_raise_ValueError(translate("Selected RTS pin not valid"));
}
if (cts != mp_const_none) {
for (uint32_t i=0; i < cts_count; ++i)
{
if (mcu_uart_cts_list[i].bank_idx == self->rx_pin->bank_idx) {
if (mcu_uart_cts_list[i].pin == cts) {
self->cts_pin = &mcu_uart_cts_list[i];
break;
}
for (uint32_t i=0; i < cts_count; ++i) {
if (mcu_uart_cts_list[i].bank_idx == self->rx_pin->bank_idx) {
if (mcu_uart_cts_list[i].pin == cts) {
self->cts_pin = &mcu_uart_cts_list[i];
break;
}
}
}
if (self->cts_pin == NULL)
mp_raise_ValueError(translate("Selected CTS pin not valid"));
}
@ -192,7 +189,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
uint32_t modir = (self->uart->MODIR) & ~(LPUART_MODIR_TXRTSPOL_MASK | LPUART_MODIR_TXRTSE_MASK);
if (rs485_dir != mp_const_none) {
modir |= LPUART_MODIR_TXRTSE_MASK;
if ( rs485_invert == true )
if (rs485_invert)
modir |= LPUART_MODIR_TXRTSPOL_MASK;
}
self->uart->MODIR = modir;

@ -36,8 +36,8 @@ extern const mcu_periph_obj_t mcu_spi_miso_list[4];
extern const mcu_periph_obj_t mcu_uart_rx_list[9];
extern const mcu_periph_obj_t mcu_uart_tx_list[9];
const mcu_periph_obj_t mcu_uart_rts_list[4];
const mcu_periph_obj_t mcu_uart_cts_list[4];
extern const mcu_periph_obj_t mcu_uart_rts_list[4];
extern const mcu_periph_obj_t mcu_uart_cts_list[4];
extern const mcu_pwm_obj_t mcu_pwm_list[20];

@ -36,8 +36,8 @@ extern const mcu_periph_obj_t mcu_spi_miso_list[8];
extern const mcu_periph_obj_t mcu_uart_rx_list[18];
extern const mcu_periph_obj_t mcu_uart_tx_list[18];
const mcu_periph_obj_t mcu_uart_rts_list[9];
const mcu_periph_obj_t mcu_uart_cts_list[9];
extern const mcu_periph_obj_t mcu_uart_rts_list[9];
extern const mcu_periph_obj_t mcu_uart_cts_list[9];
extern const mcu_pwm_obj_t mcu_pwm_list[67];

@ -135,7 +135,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
uint32_t baudrate, uint8_t bits, uart_parity_t parity, uint8_t stop,
mp_float_t timeout, uint16_t receiver_buffer_size) {
if ((rts != mp_const_none) || (cts != mp_const_none) || (rs485_dir != mp_const_none) || (rs485_invert == true)) {
if ((rts != mp_const_none) || (cts != mp_const_none) || (rs485_dir != mp_const_none) || (rs485_invert)) {
mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device"));
}

Loading…
Cancel
Save