Merge pull request #14387 from mark-psl/master

Update serial_api.c - Issue #14353 - Setting BufferedSerial pin to NC throws runtime assertion
pull/14402/head
Martin Kojtal 2021-03-09 17:29:45 +00:00 committed by GitHub
commit 7a707de9d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -63,14 +63,14 @@ void serial_init_direct(serial_t *obj, const serial_pinmap_t *pinmap)
UART_Init(uart_addrs[obj->serial.index], &config, CLOCK_GetFreq(uart_clocks[obj->serial.index])); UART_Init(uart_addrs[obj->serial.index], &config, CLOCK_GetFreq(uart_clocks[obj->serial.index]));
pin_function(pinmap->tx_pin, pinmap->tx_function);
pin_function(pinmap->rx_pin, pinmap->rx_function);
if (pinmap->tx_pin != NC) { if (pinmap->tx_pin != NC) {
pin_function(pinmap->tx_pin, pinmap->tx_function);
UART_EnableTx(uart_addrs[obj->serial.index], true); UART_EnableTx(uart_addrs[obj->serial.index], true);
pin_mode(pinmap->tx_pin, PullUp); pin_mode(pinmap->tx_pin, PullUp);
} }
if (pinmap->rx_pin != NC) { if (pinmap->rx_pin != NC) {
pin_function(pinmap->rx_pin, pinmap->rx_function);
UART_EnableRx(uart_addrs[obj->serial.index], true); UART_EnableRx(uart_addrs[obj->serial.index], true);
pin_mode(pinmap->rx_pin, PullUp); pin_mode(pinmap->rx_pin, PullUp);
} }