From 91f8940c6a9d9b708ba50fbce1a735fd62f7a0c1 Mon Sep 17 00:00:00 2001
From: Christian Riggenbach <criggenbach@magahugu.ch>
Date: Fri, 13 May 2022 20:44:22 +0200
Subject: [PATCH 1/2] _begun isn't needed; it is only set, never read

---
 Adafruit_SPIDevice.cpp | 3 ---
 Adafruit_SPIDevice.h   | 1 -
 2 files changed, 4 deletions(-)

diff --git a/Adafruit_SPIDevice.cpp b/Adafruit_SPIDevice.cpp
index 44a8f55..a4184e8 100644
--- a/Adafruit_SPIDevice.cpp
+++ b/Adafruit_SPIDevice.cpp
@@ -20,7 +20,6 @@ Adafruit_SPIDevice::Adafruit_SPIDevice(int8_t cspin, uint32_t freq,
   _cs = cspin;
   _sck = _mosi = _miso = -1;
   _spi = theSPI;
-  _begun = false;
   _spiSetting = new SPISettings(freq, dataOrder, dataMode);
   _freq = freq;
   _dataOrder = dataOrder;
@@ -67,7 +66,6 @@ Adafruit_SPIDevice::Adafruit_SPIDevice(int8_t cspin, int8_t sckpin,
   _freq = freq;
   _dataOrder = dataOrder;
   _dataMode = dataMode;
-  _begun = false;
   _spiSetting = new SPISettings(freq, dataOrder, dataMode);
   _spi = nullptr;
 }
@@ -109,7 +107,6 @@ bool Adafruit_SPIDevice::begin(void) {
     }
   }
 
-  _begun = true;
   return true;
 }
 
diff --git a/Adafruit_SPIDevice.h b/Adafruit_SPIDevice.h
index 3a792c7..f433c88 100644
--- a/Adafruit_SPIDevice.h
+++ b/Adafruit_SPIDevice.h
@@ -116,7 +116,6 @@ class Adafruit_SPIDevice {
   BusIO_PortReg *mosiPort, *clkPort, *misoPort, *csPort;
   BusIO_PortMask mosiPinMask, misoPinMask, clkPinMask, csPinMask;
 #endif
-  bool _begun;
 };
 
 #endif // has SPI defined

From d3b8d6039777a1a4132f0212da089beaf5a37d33 Mon Sep 17 00:00:00 2001
From: Christian Riggenbach <criggenbach@magahugu.ch>
Date: Sat, 14 May 2022 20:13:14 +0200
Subject: [PATCH 2/2] added debug level for software SPI

---
 Adafruit_SPIDevice.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Adafruit_SPIDevice.cpp b/Adafruit_SPIDevice.cpp
index a4184e8..bc1128b 100644
--- a/Adafruit_SPIDevice.cpp
+++ b/Adafruit_SPIDevice.cpp
@@ -4,6 +4,7 @@
     (defined(SPI_INTERFACES_COUNT) && (SPI_INTERFACES_COUNT > 0))
 
 //#define DEBUG_SERIAL Serial
+// #define DEBUG_SWSERIAL
 
 /*!
  *    @brief  Create an SPI device with the given CS pin and settings
@@ -148,13 +149,12 @@ void Adafruit_SPIDevice::transfer(uint8_t *buffer, size_t len) {
     uint8_t reply = 0;
     uint8_t send = buffer[i];
 
-    /*
+#ifdef DEBUG_SWSERIAL
     Serial.print("\tSending software SPI byte 0x");
     Serial.print(send, HEX);
     Serial.print(" -> 0x");
-    */
+#endif
 
-    // Serial.print(send, HEX);
     for (uint8_t b = startbit; b != 0;
          b = (_dataOrder == SPI_BITORDER_LSBFIRST) ? b << 1 : b >> 1) {