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