Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9876616

Browse files
committed
[SoftwareSerial] Fix analog pins usage
Fix#1093Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parentf190402 commit9876616

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎libraries/SoftwareSerial/src/SoftwareSerial.cpp‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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: invalidreceivepin number\n", -1);
326326
}
327327
}
328328

@@ -421,4 +421,4 @@ int SoftwareSerial::peek()
421421
voidSoftwareSerial::setInterruptPriority(uint32_t preemptPriority,uint32_t subPriority)
422422
{
423423
timer.setInterruptPriority(preemptPriority, subPriority);
424-
}
424+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp