Skip to content

Commit c07701e

Browse files
authored
Merge pull request #121 from caternuson/esp32_warns
Remove volatile compound assignments
2 parents 4d27615 + 2708c12 commit c07701e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Adafruit_SPIDevice.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,17 @@ void Adafruit_SPIDevice::transfer(uint8_t *buffer, size_t len) {
183183
if ((_mosi != -1) && (lastmosi != towrite)) {
184184
#ifdef BUSIO_USE_FAST_PINIO
185185
if (towrite)
186-
*mosiPort |= mosiPinMask;
186+
*mosiPort = *mosiPort | mosiPinMask;
187187
else
188-
*mosiPort &= ~mosiPinMask;
188+
*mosiPort = *mosiPort & ~mosiPinMask;
189189
#else
190190
digitalWrite(_mosi, towrite);
191191
#endif
192192
lastmosi = towrite;
193193
}
194194

195195
#ifdef BUSIO_USE_FAST_PINIO
196-
*clkPort |= clkPinMask; // Clock high
196+
*clkPort = *clkPort | clkPinMask; // Clock high
197197
#else
198198
digitalWrite(_sck, HIGH);
199199
#endif
@@ -213,14 +213,14 @@ void Adafruit_SPIDevice::transfer(uint8_t *buffer, size_t len) {
213213
}
214214

215215
#ifdef BUSIO_USE_FAST_PINIO
216-
*clkPort &= ~clkPinMask; // Clock low
216+
*clkPort = *clkPort & ~clkPinMask; // Clock low
217217
#else
218218
digitalWrite(_sck, LOW);
219219
#endif
220220
} else { // if (_dataMode == SPI_MODE1 || _dataMode == SPI_MODE3)
221221

222222
#ifdef BUSIO_USE_FAST_PINIO
223-
*clkPort |= clkPinMask; // Clock high
223+
*clkPort = *clkPort | clkPinMask; // Clock high
224224
#else
225225
digitalWrite(_sck, HIGH);
226226
#endif
@@ -232,16 +232,16 @@ void Adafruit_SPIDevice::transfer(uint8_t *buffer, size_t len) {
232232
if (_mosi != -1) {
233233
#ifdef BUSIO_USE_FAST_PINIO
234234
if (send & b)
235-
*mosiPort |= mosiPinMask;
235+
*mosiPort = *mosiPort | mosiPinMask;
236236
else
237-
*mosiPort &= ~mosiPinMask;
237+
*mosiPort = *mosiPort & ~mosiPinMask;
238238
#else
239239
digitalWrite(_mosi, send & b);
240240
#endif
241241
}
242242

243243
#ifdef BUSIO_USE_FAST_PINIO
244-
*clkPort &= ~clkPinMask; // Clock low
244+
*clkPort = *clkPort & ~clkPinMask; // Clock low
245245
#else
246246
digitalWrite(_sck, LOW);
247247
#endif

0 commit comments

Comments
 (0)