Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Jan 14, 2025
1 parent 571d7cd commit 9543fd5
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions cpp/buses/bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,7 @@ int Bus::MsgInHandShake()
{
const BusPhase phase = GetPhase();

if (!WaitSignal(PIN_REQ, true)) {
return -1;
}

// Phase error
if (GetPhase() != phase) {
if (!WaitSignal(PIN_REQ, true) || GetPhase() != phase) {
return -1;
}

Expand Down Expand Up @@ -162,12 +157,7 @@ int Bus::ReceiveHandShake(uint8_t *buf, int count)
const BusPhase phase = GetPhase();

for (bytes_received = 0; bytes_received < count; ++bytes_received) {
if (!WaitSignal(PIN_REQ, true)) {
break;
}

// Phase error
if (GetPhase() != phase) {
if (!WaitSignal(PIN_REQ, true) || GetPhase() != phase) {
break;
}

Expand Down

0 comments on commit 9543fd5

Please sign in to comment.