Adds an error message to HardwareSerial::setPins() (#7040)
* Adds an error message to HardwareSerial::setPins() In order to avoid problems if the user tries to setPins() before initializing the Serial port with begin()
This commit is contained in:
parent
03e2ad9b90
commit
c996036e61
1 changed files with 4 additions and 0 deletions
|
|
@ -491,6 +491,10 @@ void HardwareSerial::setRxInvert(bool invert)
|
||||||
// negative Pin value will keep it unmodified
|
// negative Pin value will keep it unmodified
|
||||||
void HardwareSerial::setPins(int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin)
|
void HardwareSerial::setPins(int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin)
|
||||||
{
|
{
|
||||||
|
if(_uart == NULL) {
|
||||||
|
log_e("setPins() shall be called after begin() - nothing done");
|
||||||
|
return;
|
||||||
|
}
|
||||||
uartSetPins(_uart, rxPin, txPin, ctsPin, rtsPin);
|
uartSetPins(_uart, rxPin, txPin, ctsPin, rtsPin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue