mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 01:11:10 +03:00
nmea_gps: renamed vk2828u7 to nmea_gps
This driver will serve as a generic module for grabbing NMEA data from various GPS devices via a serial interface. ublox6 will also be removed in favor of using this driver going forward. Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
@ -87,7 +87,7 @@ link_directories (${MRAA_LIBDIR})
|
||||
# mq? will use module gas
|
||||
# grove* will use module grove
|
||||
add_example (dfrph)
|
||||
add_example (vk2828u7)
|
||||
add_example (nmea_gps)
|
||||
add_example (mma7361)
|
||||
add_example (bh1750)
|
||||
add_example (urm37)
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "vk2828u7.h"
|
||||
#include "nmea_gps.h"
|
||||
|
||||
bool shouldRun = true;
|
||||
|
||||
@ -43,13 +43,13 @@ int main()
|
||||
|
||||
//! [Interesting]
|
||||
|
||||
// Instantiate a VK2828U7 sensor on uart 0 at 9600 baud with enable
|
||||
// pin on D3
|
||||
vk2828u7_context sensor = vk2828u7_init(0, 9600, 3);
|
||||
// Instantiate a NMEA_GPS sensor on uart 0 at 9600 baud with enable
|
||||
// pin on D3. If you do not need an enable pin, you can specify -1.
|
||||
nmea_gps_context sensor = nmea_gps_init(0, 9600, 3);
|
||||
|
||||
if (!sensor)
|
||||
{
|
||||
printf("vk2828u7_init() failed.\n");
|
||||
printf("nmea_gps_init() failed.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -57,9 +57,9 @@ int main()
|
||||
int rv = 0;
|
||||
|
||||
// loop, dumping NMEA data out as fast as it comes in
|
||||
while (shouldRun && vk2828u7_data_available(sensor, 5000))
|
||||
while (shouldRun && nmea_gps_data_available(sensor, 5000))
|
||||
{
|
||||
if ((rv = vk2828u7_read(sensor, buffer, bufferLength)) >= 0)
|
||||
if ((rv = nmea_gps_read(sensor, buffer, bufferLength)) >= 0)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<rv; i++)
|
||||
@ -74,7 +74,7 @@ int main()
|
||||
|
||||
printf("Exiting\n");
|
||||
|
||||
vk2828u7_close(sensor);
|
||||
nmea_gps_close(sensor);
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user