@@ -317,12 +317,12 @@ SoftwareSerial::SoftwareSerial(uint16_t receivePin, uint16_t transmitPin, bool i
317317 _receive_buffer_tail(0 ),
318318 _receive_buffer_head(0 )
319319{
320- if ((receivePin < NUM_DIGITAL_PINS) || (transmitPin < NUM_DIGITAL_PINS)) {
321- /* Enable GPIO clock for tx and rx pin */
322- set_GPIO_Port_Clock ( STM_PORT ( digitalPinToPinName (transmitPin)) );
323- set_GPIO_Port_Clock ( STM_PORT ( digitalPinToPinName (receivePin)));
324- } else {
325- _Error_Handler (" ERROR: invalid pin number\n " , -1 );
320+ /* Enable GPIO clock for tx and rx pin */
321+ if ( set_GPIO_Port_Clock ( STM_PORT ( digitalPinToPinName (transmitPin))) == 0 ) {
322+ _Error_Handler ( " ERROR: invalid transmit pin number \n " , - 1 );
323+ }
324+ if ((!_half_duplex) && ( set_GPIO_Port_Clock ( STM_PORT ( digitalPinToPinName (receivePin))) == 0 )) {
325+ _Error_Handler (" ERROR: invalidreceive pin number\n " , -1 );
326326 }
327327}
328328
@@ -421,4 +421,4 @@ int SoftwareSerial::peek()
421421void SoftwareSerial::setInterruptPriority (uint32_t preemptPriority,uint32_t subPriority)
422422{
423423 timer.setInterruptPriority (preemptPriority, subPriority);
424- }
424+ }