Skip to content

Commit 4bd5ed8

Browse files
committed
Fix bool error. Cast _pullups var for added protection.
1 parent 17a3933 commit 4bd5ed8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

libraries/Wire/src/Wire.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ void TwoWire::setPullups(uint32_t pullupAmount)
114114
{
115115
if (pullupAmount == 0)
116116
_pullups = AM_HAL_GPIO_PIN_PULLUP_NONE;
117-
if (pullupAmount > 0 || pullupAmount < 6)
117+
if (pullupAmount > 0 && pullupAmount < 6)
118118
_pullups = AM_HAL_GPIO_PIN_PULLUP_1_5K;
119-
else if (pullupAmount >= 6 || pullupAmount < 12)
119+
else if (pullupAmount >= 6 && pullupAmount < 12)
120120
_pullups = AM_HAL_GPIO_PIN_PULLUP_6K;
121-
else if (pullupAmount >= 12 || pullupAmount < 24)
121+
else if (pullupAmount >= 12 && pullupAmount < 24)
122122
_pullups = AM_HAL_GPIO_PIN_PULLUP_12K;
123123
else if (pullupAmount >= 24)
124124
_pullups = AM_HAL_GPIO_PIN_PULLUP_24K;

libraries/Wire/src/Wire.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class TwoWire : public Stream, public IOMaster
7474

7575
bool _transmissionBegun;
7676
uint8_t _transmissionAddress;
77-
uint32_t _pullups;
77+
am_hal_gpio_pullup_e _pullups;
7878
uint32_t _clockSpeed;
7979

8080
RingBufferN<AP3_WIRE_RX_BUFFER_LEN> _rxBuffer; // RX Buffer

0 commit comments

Comments
 (0)