From a758ee3b2561dfa9a88fd9ebc2d462b005e5d501 Mon Sep 17 00:00:00 2001 From: Matthew Zamora Date: Fri, 4 Oct 2024 19:54:09 -0400 Subject: [PATCH] Clang style improvement --- src/fipsy.cpp | 9 +++++---- src/fipsy.hpp | 2 +- src/internal/jedec.cpp | 9 ++++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/fipsy.cpp b/src/fipsy.cpp index 433e5dc..b941270 100644 --- a/src/fipsy.cpp +++ b/src/fipsy.cpp @@ -18,10 +18,11 @@ Fipsy::begin(int8_t sck = -1, int8_t miso = -1, int8_t mosi = -1, int8_t ss = -1 return deviceId == 0x012B8043 || deviceId == 0x012BA043; } -uint32_t Fipsy::getID() { - auto resp = spiTrans<8>({0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}); - uint32_t deviceId = (resp[4] << 24) | (resp[5] << 16) | (resp[6] << 8) | (resp[7] << 0); - return deviceId; // Return the Device ID directly +uint32_t +Fipsy::getID() { + auto resp = spiTrans<8>({0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}); + uint32_t deviceId = (resp[4] << 24) | (resp[5] << 16) | (resp[6] << 8) | (resp[7] << 0); + return deviceId; // Return the Device ID directly } void diff --git a/src/fipsy.hpp b/src/fipsy.hpp index a2749a3..e2512de 100644 --- a/src/fipsy.hpp +++ b/src/fipsy.hpp @@ -37,7 +37,7 @@ class Fipsy { * @return Whether expected Device ID is found. */ bool begin(int8_t sck, int8_t miso, int8_t mosi, int8_t ss); - + /** * @brief Detect Fipsy device ID. * @return Return any Device ID found. diff --git a/src/internal/jedec.cpp b/src/internal/jedec.cpp index 307cb95..31cccc2 100644 --- a/src/internal/jedec.cpp +++ b/src/internal/jedec.cpp @@ -150,7 +150,7 @@ class JedecParser { bool handleL() { printf("Doing function: HandleL\n"); int addr = 0; - while(true) { + while (true) { char ch; // readChar() does not let us capture terminal strings, so doing it manually here // this fixes a bug where readChar() denpends on sizeQf length - which is NOT related @@ -159,13 +159,16 @@ class JedecParser { // printf("Char here is [%c] booleab pass: %B\n",ch, ch=='0'); - if (!(ch >= '0' && ch <= '9')) {break;} + if (!(ch >= '0' && ch <= '9')) { + break; + } + if (!appendDigit<10>(addr, ch)) { return false; } } - printf("Starting addr: %d\n",addr); + printf("Starting addr: %d\n", addr); while (true) { char ch = readChar();