Skip to content

Commit

Permalink
Clang style improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
mattzamora committed Oct 4, 2024
1 parent 0e2557c commit a758ee3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/fipsy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/fipsy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 6 additions & 3 deletions src/internal/jedec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
Expand Down

0 comments on commit a758ee3

Please sign in to comment.