Page 1 of 1

only keep newest message

Posted: Tue Jul 04, 2017 8:58 am
by close2
Hello,

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?

Regars
Christian

Re: only keep newest message

Posted: Tue Jul 04, 2017 1:59 pm
by RoccoMarco
Hi Christian,
I suggest you to take a look to Serial Driver (ChibiOS/HAL)... Do you have any experience with ChibiOS?

Re: only keep newest message

Posted: Tue Jul 04, 2017 11:16 pm
by meatball
Hi,

I think you might find this open-sourced firmware useful:

https://github.com/grantmd/ChibiCopter/ ... ster/GPS.c

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