Fix volatile compound assignments being deprecated in C++20

This commit is contained in:
BlackMark 2022-05-29 14:45:57 +02:00
parent 852ad5a318
commit 85346f258f

View File

@ -34,7 +34,7 @@ class Hardware {
setMaster();
setBitOrder();
SPCR |= (1 << SPE);
SPCR = SPCR | (1 << SPE);
}
static word_t transfer(word_t data)
@ -61,21 +61,21 @@ class Hardware {
uint8_t ui8ClockDiv = static_cast<uint8_t>(Cfg::FREQ);
if (ui8ClockDiv & 1) {
SPCR |= (1 << SPR0);
SPCR = SPCR | (1 << SPR0);
} else {
SPCR &= ~(1 << SPR0);
SPCR = SPCR & ~(1 << SPR0);
}
if (ui8ClockDiv & (1 << 1)) {
SPCR |= (1 << SPR1);
SPCR = SPCR | (1 << SPR1);
} else {
SPCR &= ~(1 << SPR1);
SPCR = SPCR & ~(1 << SPR1);
}
if (ui8ClockDiv & (1 << 2)) {
SPSR |= (1 << SPI2X);
SPSR = SPSR | (1 << SPI2X);
} else {
SPSR &= ~(1 << SPI2X);
SPSR = SPSR & ~(1 << SPI2X);
}
}
@ -97,35 +97,35 @@ class Hardware {
static void setMaster()
{
if constexpr (Cfg::SIDE == Side::MASTER) {
SPCR |= (1 << MSTR);
SPCR = SPCR | (1 << MSTR);
} else {
SPCR &= ~(1 << MSTR);
SPCR = SPCR & ~(1 << MSTR);
}
}
static void setBitOrder()
{
if constexpr (Cfg::BIT_ORDER == BitOrder::LSB_FIRST) {
SPCR |= (1 << DORD);
SPCR = SPCR | (1 << DORD);
} else {
SPCR &= ~(1 << DORD);
SPCR = SPCR & ~(1 << DORD);
}
}
static void setCPOL(bool bCPOL)
{
if (bCPOL) {
SPCR |= (1 << CPOL);
SPCR = SPCR | (1 << CPOL);
} else {
SPCR &= ~(1 << CPOL);
SPCR = SPCR & ~(1 << CPOL);
}
}
static void setCPHA(bool bCPHA)
{
if (bCPHA) {
SPCR |= (1 << CPHA);
SPCR = SPCR | (1 << CPHA);
} else {
SPCR &= ~(1 << CPHA);
SPCR = SPCR & ~(1 << CPHA);
}
}
};