Edits as a result of review

This commit is contained in:
Dave Marples 2020-02-19 00:07:01 +00:00
parent 490a808bf6
commit 24405cabaf
6 changed files with 24 additions and 27 deletions

View File

@ -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"));
}

View File

@ -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"));
}

View File

@ -123,9 +123,8 @@ 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) {
else {
if (rs485_invert) {
mp_raise_ValueError(translate("RS485 inversion specified when not in RS485 mode"));
}
}
@ -135,8 +134,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
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)
{
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];
@ -149,8 +147,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
}
if (cts != mp_const_none) {
for (uint32_t i=0; i < cts_count; ++i)
{
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];
@ -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;

View File

@ -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];

View File

@ -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];

View File

@ -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"));
}