Skip to content

Commit

Permalink
Fixed an instance of variable hiding
Browse files Browse the repository at this point in the history
  • Loading branch information
dc42 committed Jan 4, 2021
1 parent 4d13993 commit 8697460
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/CanDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,11 +878,11 @@ void CanDevice::SetExtendedFilterElement(unsigned int index, RxBufferNumber whic

void CanDevice::GetLocalCanTiming(CanTiming &timing) noexcept
{
const uint32_t nbtp = hw->REG(NBTP);
const uint32_t tseg1 = (nbtp & CAN_(NBTP_NTSEG1_Msk)) >> CAN_(NBTP_NTSEG1_Pos);
const uint32_t tseg2 = (nbtp & CAN_(NBTP_NTSEG2_Msk)) >> CAN_(NBTP_NTSEG2_Pos);
const uint32_t jw = (nbtp & CAN_(NBTP_NSJW_Msk)) >> CAN_(NBTP_NSJW_Pos);
const uint32_t brp = (nbtp & CAN_(NBTP_NBRP_Msk)) >> CAN_(NBTP_NBRP_Pos);
const uint32_t localNbtp = hw->REG(NBTP);
const uint32_t tseg1 = (localNbtp & CAN_(NBTP_NTSEG1_Msk)) >> CAN_(NBTP_NTSEG1_Pos);
const uint32_t tseg2 = (localNbtp & CAN_(NBTP_NTSEG2_Msk)) >> CAN_(NBTP_NTSEG2_Pos);
const uint32_t jw = (localNbtp & CAN_(NBTP_NSJW_Msk)) >> CAN_(NBTP_NSJW_Pos);
const uint32_t brp = (localNbtp & CAN_(NBTP_NBRP_Msk)) >> CAN_(NBTP_NBRP_Pos);
timing.period = (tseg1 + tseg2 + 3) * (brp + 1);
timing.tseg1 = (tseg1 + 1) * (brp + 1);
timing.jumpWidth = (jw + 1) * (brp + 1);
Expand Down

0 comments on commit 8697460

Please sign in to comment.