Skip to content

Commit

Permalink
Add instruction to parse NMEA message
Browse files Browse the repository at this point in the history
  • Loading branch information
waltjohnson committed Apr 9, 2024
1 parent ede4840 commit e3a3ef6
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions ExampleProjects/Communications/ISCommunicationsExample.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ int main(int argc, char* argv[])
return -1;
}


// STEP 2: Init comm instance
is_comm_instance_t comm;
uint8_t buffer[2048];
Expand All @@ -166,7 +165,6 @@ int main(int argc, char* argv[])
return -2;
}


int error;

Check warning on line 168 in ExampleProjects/Communications/ISCommunicationsExample.c

View workflow job for this annotation

GitHub Actions / cpp-linter

ExampleProjects/Communications/ISCommunicationsExample.c:168:6 [cppcoreguidelines-init-variables]

variable 'error' is not initialized

Check warning on line 168 in ExampleProjects/Communications/ISCommunicationsExample.c

View workflow job for this annotation

GitHub Actions / cpp-linter

ExampleProjects/Communications/ISCommunicationsExample.c:168:6 [cppcoreguidelines-init-variables]

variable 'error' is not initialized

// STEP 4: Stop any message broadcasting
Expand All @@ -183,24 +181,20 @@ int main(int argc, char* argv[])
}
#endif


// STEP 6: Enable message broadcasting
if ((error = enable_message_broadcasting(&serialPort, &comm)))
{
return error;
}


#if 0 // STEP 7: (Optional) Save currently enabled streams as persistent messages enabled after reboot
save_persistent_messages(&serialPort, &comm);
#endif


// STEP 8: Handle received data
int count;

Check warning on line 195 in ExampleProjects/Communications/ISCommunicationsExample.c

View workflow job for this annotation

GitHub Actions / cpp-linter

ExampleProjects/Communications/ISCommunicationsExample.c:195:6 [cppcoreguidelines-init-variables]

variable 'count' is not initialized

Check warning on line 195 in ExampleProjects/Communications/ISCommunicationsExample.c

View workflow job for this annotation

GitHub Actions / cpp-linter

ExampleProjects/Communications/ISCommunicationsExample.c:195:6 [cppcoreguidelines-init-variables]

variable 'count' is not initialized
uint8_t inByte;

Check warning on line 196 in ExampleProjects/Communications/ISCommunicationsExample.c

View workflow job for this annotation

GitHub Actions / cpp-linter

ExampleProjects/Communications/ISCommunicationsExample.c:196:10 [cppcoreguidelines-init-variables]

variable 'inByte' is not initialized

Check warning on line 196 in ExampleProjects/Communications/ISCommunicationsExample.c

View workflow job for this annotation

GitHub Actions / cpp-linter

ExampleProjects/Communications/ISCommunicationsExample.c:196:10 [cppcoreguidelines-init-variables]

variable 'inByte' is not initialized

// You can set running to false with some other piece of code to break out of the loop and end the program
while (running)
{
// Read one byte with a 20 millisecond timeout
Expand Down Expand Up @@ -231,6 +225,17 @@ int main(int argc, char* argv[])
}
break;

case _PTYPE_NMEA:
switch (getNmeaMsgId(comm.dataPtr, comm.dataHdr.size))

Check warning on line 229 in ExampleProjects/Communications/ISCommunicationsExample.c

View workflow job for this annotation

GitHub Actions / cpp-linter

ExampleProjects/Communications/ISCommunicationsExample.c:229:13 [clang-diagnostic-implicit-function-declaration]

implicit declaration of function 'getNmeaMsgId' is invalid in C99
{
case NMEA_MSG_ID_GxGGA:
// Access NMEA message here:
// comm.dataPtr
// comm.dataHdr.size
break;
}
break;

default:
break;
}
Expand Down

0 comments on commit e3a3ef6

Please sign in to comment.