From 85346f258fd7cac32b4f4d9df0350b97b8e9d9e8 Mon Sep 17 00:00:00 2001 From: BlackMark Date: Sun, 29 May 2022 14:45:57 +0200 Subject: [PATCH] Fix volatile compound assignments being deprecated in C++20 --- hardware.hpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/hardware.hpp b/hardware.hpp index c7732b0..4d849df 100644 --- a/hardware.hpp +++ b/hardware.hpp @@ -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(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); } } };