Fix double speed flag not being cleared if not used
This commit is contained in:
parent
04b6782ec4
commit
bcd18db494
18
hardware.hpp
18
hardware.hpp
@ -63,12 +63,15 @@ class Hardware {
|
||||
constexpr auto EnableRx = calcRxState<true>();
|
||||
constexpr auto EnableTx = calcTxState<true>();
|
||||
constexpr auto InterruptVal = calcInterrupt();
|
||||
constexpr auto DoubleSpeedVal = calcDoubleSpeedVal<UseDoubleSpeed>();
|
||||
|
||||
constexpr uint8_t ControlRegB = DataBitsValues.regBVal | EnableRx | EnableTx | InterruptVal;
|
||||
constexpr uint8_t ControlRegC = DataBitsValues.regCVal | ParityVal | StopBitsVal | ModeVal;
|
||||
|
||||
*getRegPtr<Registers::CTRL_STAT_REG_A_ADDR>() |= DoubleSpeedVal;
|
||||
if constexpr (UseDoubleSpeed)
|
||||
*getRegPtr<Registers::CTRL_STAT_REG_A_ADDR>() |= (1 << CtrlFlagsA::SPEED_2X);
|
||||
else
|
||||
*getRegPtr<Registers::CTRL_STAT_REG_A_ADDR>() &= ~(1 << CtrlFlagsA::SPEED_2X);
|
||||
|
||||
*getRegPtr<Registers::CTRL_STAT_REG_B_ADDR>() = ControlRegB;
|
||||
*getRegPtr<Registers::CTRL_STAT_REG_C_ADDR>() = ControlRegC;
|
||||
}
|
||||
@ -266,17 +269,6 @@ class Hardware {
|
||||
|
||||
return interruptVal;
|
||||
}
|
||||
|
||||
template <bool DoubleSpeed>
|
||||
static constexpr auto calcDoubleSpeedVal()
|
||||
{
|
||||
uint8_t doubleSpeedVal = 0;
|
||||
|
||||
if constexpr (DoubleSpeed)
|
||||
doubleSpeedVal = (1 << CtrlFlagsA::SPEED_2X);
|
||||
|
||||
return doubleSpeedVal;
|
||||
}
|
||||
};
|
||||
|
||||
template <class Registers, typename CtrlFlagsA, typename CtrlFlagsB, typename CtrlFlagsC, class cfg, Mode mode>
|
||||
|
Loading…
Reference in New Issue
Block a user