A GPS serial interrupt service routine that has an on the fly nmea parser. Works with a STM32F411RE and a Adafruit GPS logger.
Dependents: Bicycl_Computer_NUCLEO-F411RE Bicycl_Computer_NUCLEO-L476RG
Fork of GPS by
GPSISR.h
00001 /* mbed EM-406 GPS Module Library 00002 * Copyright (c) 2008-2010, sford 00003 * 00004 * Permission is hereby granted, free of charge, to any person obtaining a copy 00005 * of this software and associated documentation files (the "Software"), to deal 00006 * in the Software without restriction, including without limitation the rights 00007 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00008 * copies of the Software, and to permit persons to whom the Software is 00009 * furnished to do so, subject to the following conditions: 00010 * 00011 * The above copyright notice and this permission notice shall be included in 00012 * all copies or substantial portions of the Software. 00013 * 00014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00015 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00016 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00017 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00018 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00019 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00020 * THE SOFTWARE. 00021 */ 00022 00023 #include "mbed.h" 00024 00025 #ifndef MBED_GPS_H 00026 #define MBED_GPS_H 00027 00028 /** A GPS interface for reading from a Globalsat EM-406 GPS Module */ 00029 class GPS { 00030 public: 00031 00032 /** Create the GPS interface, connected to the specified serial port 00033 */ 00034 GPS(PinName tx, PinName rx, int Baud); 00035 //Peripheral 00036 Serial _gps; 00037 00038 // Setup a serial interrupt function to transmit data 00039 void getline(); 00040 void Rx_interrupt(void); 00041 bool dataready(void); 00042 00043 00044 //void f1(a_struct& struct); 00045 //f1(a_struct s); 00046 // Reading struct that includes the data for each reading we take 00047 struct reading { 00048 float latitude; //Signed positive if N, negative if S 00049 float longitude; //Signed positive if E, negative if W 00050 char latc; 00051 char lonc; 00052 uint8_t day; 00053 uint8_t month; 00054 uint8_t year; 00055 uint8_t hours; 00056 uint8_t minutes; 00057 uint8_t seconds; 00058 float speed; 00059 float altitude; 00060 float bearing; 00061 int satellites; 00062 }; 00063 struct reading buffer; 00064 00065 void read(void); 00066 char msg[256]; 00067 volatile char rx_in; 00068 bool interrupt; 00069 private: 00070 00071 }; 00072 00073 #endif
Generated on Tue Jul 12 2022 18:50:37 by 1.7.2