Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions cores/arduino/HardwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,22 @@ HardwareSerial::HardwareSerial(void *peripheral, HalfDuplexMode_t halfDuplex)
setTx(PIN_SERIALLP2_TX);
} else
#endif
// else get the pins of the first peripheral occurrence in PinMap
{
_serial.pin_rx = pinmap_pin(peripheral, PinMap_UART_RX);
_serial.pin_tx = pinmap_pin(peripheral, PinMap_UART_TX);
}
#if defined(PIN_SERIAL_TX)
// If PIN_SERIAL_TX is defined but Serial is mapped on other peripheral
// (usually SerialUSB) use the pins defined for specified peripheral
// instead of the first one found
if ((pinmap_peripheral(digitalPinToPinName(PIN_SERIAL_TX), PinMap_UART_TX) == peripheral)) {
#if defined(PIN_SERIAL_RX)
setRx(PIN_SERIAL_RX);
#endif
setTx(PIN_SERIAL_TX);
} else
#endif
{
// else get the pins of the first peripheral occurrence in PinMap
_serial.pin_rx = pinmap_pin(peripheral, PinMap_UART_RX);
_serial.pin_tx = pinmap_pin(peripheral, PinMap_UART_TX);
}
if (halfDuplex == HALF_DUPLEX_ENABLED) {
_serial.pin_rx = NC;
}
Expand Down