Skip to content

Commit

Permalink
Refactor default member initialization for those that are required - …
Browse files Browse the repository at this point in the history
…m_invert was lacking before.
  • Loading branch information
dok-net committed Apr 21, 2023
1 parent c0dc6d6 commit 7c9f467
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 0 additions & 8 deletions src/SoftwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,10 @@ __attribute__((always_inline)) inline void IRAM_ATTR UARTBase::restoreInterrupts
constexpr uint8_t BYTE_ALL_BITS_SET = ~static_cast<uint8_t>(0);

UARTBase::UARTBase() {
m_isrOverflow = false;
m_rxGPIOHasPullUp = false;
m_rxGPIOPullUpEnabled = true;
m_txGPIOOpenDrain = false;
}

UARTBase::UARTBase(int8_t rxPin, int8_t txPin, bool invert)
{
m_isrOverflow = false;
m_rxGPIOHasPullUp = false;
m_rxGPIOPullUpEnabled = true;
m_txGPIOOpenDrain = false;
m_rxPin = rxPin;
m_txPin = txPin;
m_invert = invert;
Expand Down
8 changes: 4 additions & 4 deletions src/SoftwareSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,9 @@ class UARTBase : public Stream {
/// PDU bits include data, parity and stop bits; the start bit is not counted.
uint8_t m_pduBits;
bool m_intTxEnabled;
bool m_rxGPIOHasPullUp;
bool m_rxGPIOPullUpEnabled;
bool m_txGPIOOpenDrain;
bool m_rxGPIOHasPullUp = false;
bool m_rxGPIOPullUpEnabled = true;
bool m_txGPIOOpenDrain = false;
Parity m_parityMode;
uint8_t m_stopBits;
bool m_lastReadParity;
Expand All @@ -367,7 +367,7 @@ class UARTBase : public Stream {
// 1 = positive including 0, 0 = negative.
std::unique_ptr<circular_queue<uint32_t, UARTBase*> > m_isrBuffer;
const Delegate<void(uint32_t&&), UARTBase*> m_isrBufferForEachDel = { [](UARTBase* self, uint32_t&& isrTick) { self->rxBits(isrTick); }, this };
std::atomic<bool> m_isrOverflow;
std::atomic<bool> m_isrOverflow = false;
uint32_t m_isrLastTick;
bool m_rxCurParity = false;
Delegate<void(), void*> m_rxHandler;
Expand Down

0 comments on commit 7c9f467

Please sign in to comment.