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:
Rodrigo Garcia 2022-07-26 10:41:04 -03:00 committed by GitHub
parent 03e2ad9b90
commit c996036e61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -491,6 +491,10 @@ void HardwareSerial::setRxInvert(bool invert)
// negative Pin value will keep it unmodified
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);
}