only keep newest message

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general.
Posts: 2
Joined: Tue Jul 04, 2017 8:39 am

only keep newest message

Postby close2 » Tue Jul 04, 2017 8:58 am


I want to read gps coordinates over UART process them and then perform actions depending on the position.

This means that there are few "subsystems" involved:
* read a line
* pass this line to a nmea parsing library
* process the coordinates (find out if any actions should be taken)
* possibly do something based on the location.

As exercise I assume that every step could take an infinite amount of time.

Contrary to most (all?) examples I would like to discard intermediate values and always work on the latest received coordinates.
Also (again mostly as exercise) my goal is to avoid copying data as much as possible.
The data passed is:
- single characters from the UART to the line reader.
- a line from the line reader to the nmea parsing lib.
- gps coordinates from the nmea parsing lib to the processing code

What primitives would you use?


User avatar
Posts: 557
Joined: Wed Apr 24, 2013 4:11 pm
Location: Salerno (Italy)
Has thanked: 65 times
Been thanked: 50 times

Re: only keep newest message

Postby RoccoMarco » Tue Jul 04, 2017 1:59 pm

Hi Christian,
I suggest you to take a look to Serial Driver (ChibiOS/HAL)... Do you have any experience with ChibiOS?

Posts: 22
Joined: Thu May 19, 2016 4:39 pm
Has thanked: 7 times

Re: only keep newest message

Postby meatball » Tue Jul 04, 2017 11:16 pm


I think you might find this open-sourced firmware useful: ... ster/GPS.c

It's not mine, but the character and line parsing you need to get started is found in there.

Return to “User Projects”

Who is online

Users browsing this forum: No registered users and 1 guest