From 868a7918d999060aaeeddd941642e495033dd762 Mon Sep 17 00:00:00 2001 From: Udo Munk Date: Mon, 13 May 2024 09:43:35 +0200 Subject: [PATCH 1/3] conditional compile debug output --- Adafruit_FRAM_SPI.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Adafruit_FRAM_SPI.cpp b/Adafruit_FRAM_SPI.cpp index 256eabf..c33e407 100644 --- a/Adafruit_FRAM_SPI.cpp +++ b/Adafruit_FRAM_SPI.cpp @@ -34,6 +34,8 @@ #include "Adafruit_FRAM_SPI.h" +#define FRAM_DEBUG 0 + /// Supported flash devices const struct { uint8_t manufID; ///< Manufacture ID @@ -152,15 +154,21 @@ bool Adafruit_FRAM_SPI::begin(uint8_t nAddressSizeBytes) { _dev_idx = get_supported_idx(manufID, prodID); if (_dev_idx == -1) { + #if FRAM_DEBUG Serial.print(F("Unexpected Device: Manufacturer ID = 0x")); Serial.print(manufID, HEX); Serial.print(F(", Product ID = 0x")); Serial.println(prodID, HEX); + #endif + return false; } else { - uint32_t fram_size = _supported_devices[_dev_idx].size; + uint32_t const fram_size = _supported_devices[_dev_idx].size; + + #if FRAM_DEBUG Serial.print(F("FRAM Size = 0x")); Serial.println(fram_size, HEX); + #endif // Detect address size in bytes either 2 or 3 bytes (4 bytes is not // supported) From 5155596b98fca4fde14dd5c708d5b110cf00a174 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 18 Jul 2024 16:38:57 +0700 Subject: [PATCH 2/3] fix clang --- Adafruit_FRAM_SPI.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Adafruit_FRAM_SPI.cpp b/Adafruit_FRAM_SPI.cpp index c33e407..cad788e 100644 --- a/Adafruit_FRAM_SPI.cpp +++ b/Adafruit_FRAM_SPI.cpp @@ -154,21 +154,21 @@ bool Adafruit_FRAM_SPI::begin(uint8_t nAddressSizeBytes) { _dev_idx = get_supported_idx(manufID, prodID); if (_dev_idx == -1) { - #if FRAM_DEBUG +#if FRAM_DEBUG Serial.print(F("Unexpected Device: Manufacturer ID = 0x")); Serial.print(manufID, HEX); Serial.print(F(", Product ID = 0x")); Serial.println(prodID, HEX); - #endif +#endif return false; } else { uint32_t const fram_size = _supported_devices[_dev_idx].size; - #if FRAM_DEBUG +#if FRAM_DEBUG Serial.print(F("FRAM Size = 0x")); Serial.println(fram_size, HEX); - #endif +#endif // Detect address size in bytes either 2 or 3 bytes (4 bytes is not // supported) From d5e94c25ae19518ac5fc8b070f1be12ba5e29717 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 18 Jul 2024 16:45:10 +0700 Subject: [PATCH 3/3] fix doxygen --- Adafruit_FRAM_SPI.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Adafruit_FRAM_SPI.cpp b/Adafruit_FRAM_SPI.cpp index cad788e..81f2e00 100644 --- a/Adafruit_FRAM_SPI.cpp +++ b/Adafruit_FRAM_SPI.cpp @@ -34,6 +34,7 @@ #include "Adafruit_FRAM_SPI.h" +/// Enable debug output #define FRAM_DEBUG 0 /// Supported flash devices