GPSProvider wrapper library for STMicroelectronics' X-NUCLEO-GNSS1A1 Expansion Board.

Dependents:   TeseoLocation

X_NUCLEO_GNSS1A1 Library

GPS_Provider wrapper library for STMicroelectronics' X-NUCLEO-GNSS1A1 component.

Overview

This library includes drivers for ST’s Teseo-LIV3F Global Navigation Satellite System (GNSS) device and middleware for the NMEA protocol support. This firmware package implements the port of the GPS_Provider to STMicroelectronics' X-NUCLEO-GNSS1A1 GNSS Expansion Board.

The key features of the library are:

  • Complete software to build applications using Teseo-LIV3F GNSS device
  • Middleware for the NMEA protocol support

Furthermore the library provides the following advanced features:

  • Geofencing - allows the Teseo-LIV3F receiver to raise a NMEA message when the resolved GNSS position is close to or entering or exiting from a specific circle
  • Odometer - provides information on the traveled distance using only the resolved GNSS position
  • Data Logging - allows the Teseo-LIV3F receiver to save locally on the flash the resolved GNSS position to be retrieved on demand from the Host

Hardware description

The X-NUCLEO-GNSS1A1 is a Global Navigation Satellite System Expansion Board usable with the STM32 Nucleo system and other Arduino compatible platforms. It is designed around the STMicroelectronics Teseo-LIV3F GNSS receiver IC working on multiple constellations (GPS/Galileo/Glonass/BeiDou/QZSS).

The Teseo-LIV3F module is designed for top performance in a minimal space. Within its 10x10mm compact size, Teseo-LIV3F offers superior accuracy thanks to the on board 26MHz Temperature Compensated Crystal Oscillator (TCXO) and a reduced Time To First Fix (TTFF) relying to its dedicated 32KHz Real Time Clock (RTC) oscillator.

The X-NUCLEO-GNSS1A1, hosting the Teseo-LIV3F, is compatible with Arduino UNO R3 connector layout and interfaces with the MCU via the UART channel. To connect by serial port the GNSS receiver and the host the following parameters must be used:

  • 8 data bits
  • No parity
  • 1 stop bit
  • 9600 bauds

A GPS/GLONASS/Beidou antenna, distributed along with the X-NUCLEO-GNSS1A1 Expansion Board, must be connected to the antenna connector present on the Expansion Board. For the X-NUCLEO-GNSS1A1 proper operations, the following jumper settings must be used:

  • J2 open
  • J3 closed
  • J4 closed
  • J5 open
  • J6 closed
  • J7 closed
  • J8 open
  • J9 closed
  • J10 open
  • J11 closed
  • J12 closed
  • J13 closed
  • J14 closed
  • J15 closed

Tested platforms

This firmware has been tested on STM32 NUCLEO-F401RE

Example Application

To run GNSS example applications using X-NUCLEO-GNSS1A1 Expansion Board based on mbed OS, please refer to TeseoLocation page.

Committer:
apalmieri
Date:
Thu Feb 14 11:37:40 2019 +0000
Revision:
4:9d0addf682f0
Parent:
3:2d568ec8da14
Child:
5:1fe1ba1f0013
Update .json file

Who changed what in which revision?

UserRevisionLine numberNew contents of line
apalmieri 0:a77f1f1f8318 1 /**
apalmieri 0:a77f1f1f8318 2 *******************************************************************************
apalmieri 0:a77f1f1f8318 3 * @file Teseo.h
apalmieri 0:a77f1f1f8318 4 * @author AST / Central Lab
apalmieri 0:a77f1f1f8318 5 * @version V1.0.0
apalmieri 0:a77f1f1f8318 6 * @date May-2017
apalmieri 0:a77f1f1f8318 7 * @brief Teseo Location Class
apalmieri 0:a77f1f1f8318 8 *
apalmieri 0:a77f1f1f8318 9 *******************************************************************************
apalmieri 0:a77f1f1f8318 10 * @attention
apalmieri 0:a77f1f1f8318 11 *
apalmieri 0:a77f1f1f8318 12 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
apalmieri 0:a77f1f1f8318 13 *
apalmieri 0:a77f1f1f8318 14 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
apalmieri 0:a77f1f1f8318 15 * You may not use this file except in compliance with the License.
apalmieri 0:a77f1f1f8318 16 * You may obtain a copy of the License at:
apalmieri 0:a77f1f1f8318 17 *
apalmieri 0:a77f1f1f8318 18 * http://www.st.com/software_license_agreement_liberty_v2
apalmieri 0:a77f1f1f8318 19 *
apalmieri 0:a77f1f1f8318 20 * Redistribution and use in source and binary forms, with or without modification,
apalmieri 0:a77f1f1f8318 21 * are permitted provided that the following conditions are met:
apalmieri 0:a77f1f1f8318 22 * 1. Redistributions of source code must retain the above copyright notice,
apalmieri 0:a77f1f1f8318 23 * this list of conditions and the following disclaimer.
apalmieri 0:a77f1f1f8318 24 * 2. Redistributions in binary form must reproduce the above copyright notice,
apalmieri 0:a77f1f1f8318 25 * this list of conditions and the following disclaimer in the documentation
apalmieri 0:a77f1f1f8318 26 * and/or other materials provided with the distribution.
apalmieri 0:a77f1f1f8318 27 * 3. Neither the name of STMicroelectronics nor the names of its contributors
apalmieri 0:a77f1f1f8318 28 * may be used to endorse or promote products derived from this software
apalmieri 0:a77f1f1f8318 29 * without specific prior written permission.
apalmieri 0:a77f1f1f8318 30 *
apalmieri 0:a77f1f1f8318 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
apalmieri 0:a77f1f1f8318 32 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
apalmieri 0:a77f1f1f8318 33 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
apalmieri 0:a77f1f1f8318 34 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
apalmieri 0:a77f1f1f8318 35 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
apalmieri 0:a77f1f1f8318 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
apalmieri 0:a77f1f1f8318 37 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
apalmieri 0:a77f1f1f8318 38 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
apalmieri 0:a77f1f1f8318 39 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
apalmieri 0:a77f1f1f8318 40 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
apalmieri 0:a77f1f1f8318 41 *
apalmieri 0:a77f1f1f8318 42 ********************************************************************************
apalmieri 0:a77f1f1f8318 43 */
apalmieri 0:a77f1f1f8318 44
apalmieri 0:a77f1f1f8318 45 #ifndef __TESEO_H__
apalmieri 0:a77f1f1f8318 46 #define __TESEO_H__
apalmieri 0:a77f1f1f8318 47
apalmieri 0:a77f1f1f8318 48 #include "mbed.h"
apalmieri 0:a77f1f1f8318 49 #include "GPSProviderImplBase.h"
apalmieri 0:a77f1f1f8318 50
apalmieri 0:a77f1f1f8318 51 #include "TeseoConfig.h"
apalmieri 0:a77f1f1f8318 52 #include "NMEAParser.h"
apalmieri 0:a77f1f1f8318 53
apalmieri 0:a77f1f1f8318 54 #define STD_UART_BAUD 9600// 9600
apalmieri 0:a77f1f1f8318 55 #define FWU_UART_BAUD 115200
apalmieri 0:a77f1f1f8318 56 #define TESEO_I2C_ADDRESS 0x3A
apalmieri 0:a77f1f1f8318 57 #define POWERON_STABLE_SIGNAL_DELAY_MS 150
apalmieri 0:a77f1f1f8318 58
apalmieri 0:a77f1f1f8318 59 /** Indicates the outputted location information */
apalmieri 0:a77f1f1f8318 60 #define LOC_OUTPUT_LOCATION (1)
apalmieri 0:a77f1f1f8318 61 #define LOC_OUTPUT_NMEA (2)
apalmieri 0:a77f1f1f8318 62 #define LOC_OUTPUT_PSTM (3)
apalmieri 0:a77f1f1f8318 63
apalmieri 0:a77f1f1f8318 64 #if 1
apalmieri 0:a77f1f1f8318 65 #define TESEO_LOG_INFO(...)
apalmieri 0:a77f1f1f8318 66 #else
apalmieri 0:a77f1f1f8318 67 #define TESEO_LOG_INFO(...) { \
apalmieri 0:a77f1f1f8318 68 if (_serialDebug != NULL) { \
apalmieri 0:a77f1f1f8318 69 (_serialDebug->printf(__VA_ARGS__)); \
apalmieri 0:a77f1f1f8318 70 } \
apalmieri 0:a77f1f1f8318 71 }
apalmieri 0:a77f1f1f8318 72 #endif
apalmieri 0:a77f1f1f8318 73
apalmieri 0:a77f1f1f8318 74 /**
apalmieri 0:a77f1f1f8318 75 * @brief Constant that indicates the maximum number of nmea messages to be processed.
apalmieri 0:a77f1f1f8318 76 */
apalmieri 0:a77f1f1f8318 77 #define NMEA_MSGS_NUM 6 //Note: update this constant coherently to eMsg enum type
apalmieri 0:a77f1f1f8318 78
apalmieri 0:a77f1f1f8318 79 /**
apalmieri 0:a77f1f1f8318 80 * @brief Constant that indicates the maximum number of proprietary nmea messages to be processed.
apalmieri 0:a77f1f1f8318 81 */
apalmieri 0:a77f1f1f8318 82 #define PSTM_NMEA_MSGS_NUM 5 //Note: update this constant coherently to ePSTMsg enum type
apalmieri 0:a77f1f1f8318 83
apalmieri 0:a77f1f1f8318 84 /**
apalmieri 0:a77f1f1f8318 85 * @brief Constant that indicates the maximum number of positions that can be stored.
apalmieri 0:a77f1f1f8318 86 */
apalmieri 0:a77f1f1f8318 87 #define MAX_STOR_POS 64
apalmieri 0:a77f1f1f8318 88
apalmieri 0:a77f1f1f8318 89 /**
apalmieri 0:a77f1f1f8318 90 * @brief Constant that indicates the lenght of the buffer that stores the GPS data read by the GPS expansion.
apalmieri 0:a77f1f1f8318 91 */
apalmieri 0:a77f1f1f8318 92
apalmieri 0:a77f1f1f8318 93 #define TESEO_RXBUF_LEN 256//90
apalmieri 0:a77f1f1f8318 94 #define TESEO_RXQUEUE_LEN 8
apalmieri 0:a77f1f1f8318 95
apalmieri 0:a77f1f1f8318 96 /**
apalmieri 0:a77f1f1f8318 97 * @brief Enumeration structure that containes the two success states of a process
apalmieri 0:a77f1f1f8318 98 */
apalmieri 0:a77f1f1f8318 99 typedef enum {
apalmieri 0:a77f1f1f8318 100 TESEO_STATUS_SUCCESS = 0, /**< Success status */
apalmieri 0:a77f1f1f8318 101 TESEO_STATUS_FAILURE = 1 /**< Failure status */
apalmieri 0:a77f1f1f8318 102 } eStatus;
apalmieri 0:a77f1f1f8318 103
apalmieri 0:a77f1f1f8318 104 /** Location event definitions */
apalmieri 0:a77f1f1f8318 105 typedef enum {
apalmieri 0:a77f1f1f8318 106 /** Start result event */
apalmieri 0:a77f1f1f8318 107 TESEO_LOC_EVENT_START_RESULT,
apalmieri 0:a77f1f1f8318 108 /** Stop result event */
apalmieri 0:a77f1f1f8318 109 TESEO_LOC_EVENT_STOP_RESULT,
apalmieri 0:a77f1f1f8318 110 } eTeseoLocEventType;
apalmieri 0:a77f1f1f8318 111
apalmieri 0:a77f1f1f8318 112 /** Teseo Location state */
apalmieri 0:a77f1f1f8318 113 typedef enum {
apalmieri 0:a77f1f1f8318 114 TESEO_LOC_STATE_IDLE,
apalmieri 0:a77f1f1f8318 115 TESEO_LOC_STATE_RUN,
apalmieri 0:a77f1f1f8318 116 TESEO_LOC_STATE_FEATURE,
apalmieri 0:a77f1f1f8318 117 TESEO_LOC_STATE_DEBUG
apalmieri 0:a77f1f1f8318 118 } eTeseoLocState;
apalmieri 0:a77f1f1f8318 119
apalmieri 0:a77f1f1f8318 120 /**
apalmieri 0:a77f1f1f8318 121 * @brief Enumeration structure that containes the two states of a debug process
apalmieri 0:a77f1f1f8318 122 */
apalmieri 0:a77f1f1f8318 123 typedef enum {
apalmieri 0:a77f1f1f8318 124 DEBUG_OFF = 0, /**< In this case, nothing will be printed on the console (nmea strings, positions and so on) */
apalmieri 0:a77f1f1f8318 125 DEBUG_ON = 1 /**< In this case, nmea strings and just acquired positions will be printed on the console */
apalmieri 0:a77f1f1f8318 126 } eDebugState;
apalmieri 0:a77f1f1f8318 127
apalmieri 0:a77f1f1f8318 128 /**
apalmieri 0:a77f1f1f8318 129 * @brief Data structure that contains the driver informations
apalmieri 0:a77f1f1f8318 130 */
apalmieri 0:a77f1f1f8318 131 typedef struct TeseoData {
apalmieri 0:a77f1f1f8318 132 eDebugState debug; /**< Debug status */
apalmieri 0:a77f1f1f8318 133 GPGGA_Infos gpgga_data; /**< $GPGGA Data holder */
apalmieri 0:a77f1f1f8318 134 GNS_Infos gns_data; /**< $--GNS Data holder */
apalmieri 0:a77f1f1f8318 135 GPGST_Infos gpgst_data; /**< $GPGST Data holder */
apalmieri 0:a77f1f1f8318 136 GPRMC_Infos gprmc_data; /**< $GPRMC Data holder */
apalmieri 0:a77f1f1f8318 137 GSA_Infos gsa_data; /**< $--GSA Data holder */
apalmieri 0:a77f1f1f8318 138 GSV_Infos gsv_data; /**< $--GSV Data holder */
apalmieri 0:a77f1f1f8318 139
apalmieri 0:a77f1f1f8318 140 Geofence_Infos geofence_data; /**< Geofence Data holder */
apalmieri 0:a77f1f1f8318 141 Odometer_Infos odo_data; /**< Odometer Data holder */
apalmieri 0:a77f1f1f8318 142 Datalog_Infos datalog_data; /**< Datalog Data holder */
apalmieri 0:a77f1f1f8318 143
apalmieri 0:a77f1f1f8318 144 Ack_Info ack; /**< */
apalmieri 0:a77f1f1f8318 145
apalmieri 0:a77f1f1f8318 146 } tTeseoData;
apalmieri 0:a77f1f1f8318 147
apalmieri 0:a77f1f1f8318 148 /** Application register this out callback function and Teseo class will pass outputted information to application */
apalmieri 0:a77f1f1f8318 149 typedef void (*teseo_app_output_callback)(uint32_t msgId, uint32_t msgType, tTeseoData *pData);
apalmieri 0:a77f1f1f8318 150 /** Application register this event callback function and Teseo class will pass internal processing event to application */
apalmieri 0:a77f1f1f8318 151 typedef void (*teseo_app_event_callback)(eTeseoLocEventType event, uint32_t data);
apalmieri 0:a77f1f1f8318 152
apalmieri 0:a77f1f1f8318 153 class Teseo : public GPSProviderImplBase {
apalmieri 0:a77f1f1f8318 154 public:
apalmieri 0:a77f1f1f8318 155
apalmieri 0:a77f1f1f8318 156 typedef enum {
apalmieri 0:a77f1f1f8318 157 TEST,
apalmieri 0:a77f1f1f8318 158 GETSWVER,
apalmieri 0:a77f1f1f8318 159 FORCESTANDBY,
apalmieri 0:a77f1f1f8318 160 RFTESTON,
apalmieri 0:a77f1f1f8318 161 RFTESTOFF,
apalmieri 0:a77f1f1f8318 162 LOWPOWER,
apalmieri 0:a77f1f1f8318 163 FWUPDATE
apalmieri 0:a77f1f1f8318 164 } eCmd;
apalmieri 0:a77f1f1f8318 165
apalmieri 0:a77f1f1f8318 166 /** NMEA messages types */
apalmieri 0:a77f1f1f8318 167 typedef enum {
apalmieri 0:a77f1f1f8318 168 GPGGA,
apalmieri 0:a77f1f1f8318 169 GNS,
apalmieri 0:a77f1f1f8318 170 GPGST,
apalmieri 0:a77f1f1f8318 171 GPRMC,
apalmieri 0:a77f1f1f8318 172 GSA,
apalmieri 0:a77f1f1f8318 173 GSV,
apalmieri 0:a77f1f1f8318 174 } eMsg;
apalmieri 0:a77f1f1f8318 175
apalmieri 0:a77f1f1f8318 176 /** NMEA proprietary messages types */
apalmieri 0:a77f1f1f8318 177 typedef enum {
apalmieri 0:a77f1f1f8318 178 PSTMGEOFENCE,
apalmieri 0:a77f1f1f8318 179 PSTMODO,
apalmieri 0:a77f1f1f8318 180 PSTMDATALOG,
apalmieri 0:a77f1f1f8318 181 PSTMSGL,
apalmieri 0:a77f1f1f8318 182 PSTMSAVEPAR
apalmieri 0:a77f1f1f8318 183 } ePSTMsg;
apalmieri 0:a77f1f1f8318 184
apalmieri 0:a77f1f1f8318 185 private:
apalmieri 0:a77f1f1f8318 186
apalmieri 0:a77f1f1f8318 187 eTeseoLocState _locState;
apalmieri 0:a77f1f1f8318 188
apalmieri 0:a77f1f1f8318 189 DigitalOut _loc_led2;
apalmieri 0:a77f1f1f8318 190 DigitalOut _reset;
apalmieri 0:a77f1f1f8318 191 DigitalOut _pps;
apalmieri 0:a77f1f1f8318 192 DigitalOut _wakeup;
apalmieri 0:a77f1f1f8318 193 PinName _uartRx;
apalmieri 0:a77f1f1f8318 194 PinName _uartTx;
apalmieri 0:a77f1f1f8318 195
apalmieri 0:a77f1f1f8318 196 Serial *_uart;
apalmieri 0:a77f1f1f8318 197 Serial *_serialDebug;
apalmieri 0:a77f1f1f8318 198 I2C *_i2c;
apalmieri 0:a77f1f1f8318 199
apalmieri 0:a77f1f1f8318 200 tTeseoData pData;
apalmieri 0:a77f1f1f8318 201 GPGGA_Infos stored_positions[MAX_STOR_POS];
apalmieri 0:a77f1f1f8318 202
apalmieri 0:a77f1f1f8318 203 int FwWaitAck();
apalmieri 0:a77f1f1f8318 204
apalmieri 0:a77f1f1f8318 205 Thread *serialStreamThread;
apalmieri 0:a77f1f1f8318 206
apalmieri 0:a77f1f1f8318 207 /**
apalmieri 0:a77f1f1f8318 208 * Command string
apalmieri 0:a77f1f1f8318 209 */
apalmieri 0:a77f1f1f8318 210 char _teseoCmd[TESEO_RXBUF_LEN];
apalmieri 0:a77f1f1f8318 211
apalmieri 0:a77f1f1f8318 212 /**
apalmieri 0:a77f1f1f8318 213 * Message struct
apalmieri 0:a77f1f1f8318 214 */
apalmieri 0:a77f1f1f8318 215 struct _teseoMsg {
apalmieri 0:a77f1f1f8318 216 uint8_t len;
apalmieri 0:a77f1f1f8318 217 uint8_t buf[TESEO_RXBUF_LEN];
apalmieri 0:a77f1f1f8318 218 };
apalmieri 0:a77f1f1f8318 219
apalmieri 0:a77f1f1f8318 220 public:
apalmieri 0:a77f1f1f8318 221
apalmieri 0:a77f1f1f8318 222 /** Constructor: Teseo
apalmieri 0:a77f1f1f8318 223 * Create the Teseo, accept specified configuration
apalmieri 0:a77f1f1f8318 224 *
apalmieri 0:a77f1f1f8318 225 * @param [in] resetPin
apalmieri 0:a77f1f1f8318 226 * GPIO pin to control location chip reset.
apalmieri 0:a77f1f1f8318 227 * @param [in] wakeupPin
apalmieri 0:a77f1f1f8318 228 * GPIO pin to detect if the chip is still wakeup.
apalmieri 0:a77f1f1f8318 229 * @param [in] ppsPin
apalmieri 0:a77f1f1f8318 230 * GPIO pin... .
apalmieri 0:a77f1f1f8318 231 * @param [in] uartTxPin
apalmieri 0:a77f1f1f8318 232 * GPIO pin for serial Tx channel between the host and the GNSS controller.
apalmieri 0:a77f1f1f8318 233 * @param [in] uartRxPin
apalmieri 0:a77f1f1f8318 234 * GPIO pin for serial Rx channel between the host and the GNSS controller.
apalmieri 0:a77f1f1f8318 235 * @param [in] serialDebug
apalmieri 0:a77f1f1f8318 236 * The debug port for diagnostic messages; can be NULL.
apalmieri 0:a77f1f1f8318 237 */
apalmieri 0:a77f1f1f8318 238 Teseo(PinName resetPin,
apalmieri 0:a77f1f1f8318 239 PinName wakeupPin,
apalmieri 0:a77f1f1f8318 240 PinName ppsPin,
apalmieri 0:a77f1f1f8318 241 PinName uartTxPin,
apalmieri 0:a77f1f1f8318 242 PinName uartRxPin,
apalmieri 0:a77f1f1f8318 243 Serial *serialDebug = NULL);
apalmieri 0:a77f1f1f8318 244
apalmieri 0:a77f1f1f8318 245 /** Constructor: Teseo
apalmieri 0:a77f1f1f8318 246 * Create the Teseo, accept specified configuration
apalmieri 0:a77f1f1f8318 247 *
apalmieri 0:a77f1f1f8318 248 * @param [in] resetPin
apalmieri 0:a77f1f1f8318 249 * GPIO pin to control location chip reset.
apalmieri 0:a77f1f1f8318 250 * @param [in] wakeupPin
apalmieri 0:a77f1f1f8318 251 * GPIO pin to detect if the chip is still wakeup.
apalmieri 0:a77f1f1f8318 252 * @param [in] ppsPin
apalmieri 0:a77f1f1f8318 253 * GPIO pin... .
apalmieri 0:a77f1f1f8318 254 * @param [in] uartTxPin
apalmieri 0:a77f1f1f8318 255 * GPIO pin for serial Tx channel between the host and the GNSS controller.
apalmieri 0:a77f1f1f8318 256 * @param [in] uartRxPin
apalmieri 0:a77f1f1f8318 257 * GPIO pin for serial Rx channel between the host and the GNSS controller.
apalmieri 0:a77f1f1f8318 258 * @param [in] i2cBus
apalmieri 0:a77f1f1f8318 259 * I2C Bus not supported yet.
apalmieri 0:a77f1f1f8318 260 * @param [in] serialDebug
apalmieri 0:a77f1f1f8318 261 * The debug port for diagnostic messages; can be NULL.
apalmieri 0:a77f1f1f8318 262 */
apalmieri 0:a77f1f1f8318 263 Teseo(PinName resetPin,
apalmieri 0:a77f1f1f8318 264 PinName wakeupPin,
apalmieri 0:a77f1f1f8318 265 PinName ppsPin,
apalmieri 0:a77f1f1f8318 266 PinName uartTxPin,
apalmieri 0:a77f1f1f8318 267 PinName uartRxPin,
apalmieri 0:a77f1f1f8318 268 I2C *i2cBus,
apalmieri 0:a77f1f1f8318 269 Serial *serialDebug = NULL);
apalmieri 0:a77f1f1f8318 270
apalmieri 0:a77f1f1f8318 271 /** Register output callback and event callback functions
apalmieri 0:a77f1f1f8318 272 * @param app_output_cb Teseo class output the location and satellite information to application
apalmieri 0:a77f1f1f8318 273 * @param app_event_cb Teseo class output the start and stop result to application
apalmieri 0:a77f1f1f8318 274 */
apalmieri 0:a77f1f1f8318 275 void TeseoLocRegOutput(teseo_app_output_callback app_output_cb, teseo_app_event_callback app_event_cb);
apalmieri 0:a77f1f1f8318 276
apalmieri 0:a77f1f1f8318 277 void SendCommand(Teseo::eCmd c);
apalmieri 0:a77f1f1f8318 278 void SendCommand(char *cmd);
apalmieri 0:a77f1f1f8318 279
apalmieri 0:a77f1f1f8318 280 int EnableLowPower();
apalmieri 0:a77f1f1f8318 281
apalmieri 0:a77f1f1f8318 282 void ReadSentence(Teseo::eMsg msg);
apalmieri 0:a77f1f1f8318 283
apalmieri 0:a77f1f1f8318 284 eStatus WakeStatus(void){
apalmieri 0:a77f1f1f8318 285 return _wakeup.read() ? TESEO_STATUS_SUCCESS : TESEO_STATUS_FAILURE;
apalmieri 0:a77f1f1f8318 286 }
apalmieri 0:a77f1f1f8318 287
apalmieri 0:a77f1f1f8318 288 void ReadProcess(void);
apalmieri 0:a77f1f1f8318 289
apalmieri 0:a77f1f1f8318 290 private:
apalmieri 0:a77f1f1f8318 291
apalmieri 0:a77f1f1f8318 292 virtual bool setPowerMode(GPSProvider::PowerMode_t pwrMode);
apalmieri 0:a77f1f1f8318 293 virtual void start(void);
apalmieri 0:a77f1f1f8318 294 virtual void stop(void);
apalmieri 0:a77f1f1f8318 295 virtual void process(void);
apalmieri 0:a77f1f1f8318 296 virtual void reset(void);
apalmieri 0:a77f1f1f8318 297 virtual const GPSProvider::LocationUpdateParams_t *getLastLocation(void) const;
apalmieri 0:a77f1f1f8318 298
apalmieri 0:a77f1f1f8318 299 gps_provider_error_t cfgMessageList(int level);
apalmieri 0:a77f1f1f8318 300 gps_provider_error_t saveConfigParams(void);
apalmieri 0:a77f1f1f8318 301
apalmieri 0:a77f1f1f8318 302 /** Set NMEA stream verbosity */
apalmieri 0:a77f1f1f8318 303 virtual void setVerboseMode(int level);
apalmieri 0:a77f1f1f8318 304
apalmieri 0:a77f1f1f8318 305 /** Geofencing */
apalmieri 0:a77f1f1f8318 306 virtual bool isGeofencingSupported(void);
apalmieri 0:a77f1f1f8318 307 virtual gps_provider_error_t enableGeofence(void);
apalmieri 0:a77f1f1f8318 308 virtual gps_provider_error_t configGeofences(GPSGeofence *geofences[], unsigned geofenceCount);
apalmieri 0:a77f1f1f8318 309 virtual gps_provider_error_t geofenceReq(void);
apalmieri 0:a77f1f1f8318 310 gps_provider_error_t cfgGeofenceCircle(void);
apalmieri 0:a77f1f1f8318 311
apalmieri 0:a77f1f1f8318 312 /** Datalogging */
apalmieri 0:a77f1f1f8318 313 virtual bool isDataloggingSupported(void);
apalmieri 0:a77f1f1f8318 314 virtual gps_provider_error_t enableDatalog(void);
apalmieri 0:a77f1f1f8318 315 virtual gps_provider_error_t configDatalog(GPSDatalog *datalog);
apalmieri 0:a77f1f1f8318 316 virtual gps_provider_error_t startDatalog(void);
apalmieri 0:a77f1f1f8318 317 virtual gps_provider_error_t stopDatalog(void);
apalmieri 0:a77f1f1f8318 318 virtual gps_provider_error_t eraseDatalog(void);
apalmieri 0:a77f1f1f8318 319 virtual gps_provider_error_t logReqStatus(void);
apalmieri 0:a77f1f1f8318 320 virtual gps_provider_error_t logReqQuery(GPSProvider::LogQueryParams_t &logReqQuery);
apalmieri 0:a77f1f1f8318 321
apalmieri 0:a77f1f1f8318 322 /* Odometer */
apalmieri 0:a77f1f1f8318 323 virtual bool isOdometerSupported(void);
apalmieri 0:a77f1f1f8318 324 virtual gps_provider_error_t enableOdo(void);
apalmieri 0:a77f1f1f8318 325 virtual gps_provider_error_t startOdo(unsigned alarmDistance);
apalmieri 0:a77f1f1f8318 326 virtual gps_provider_error_t stopOdo(void);
apalmieri 0:a77f1f1f8318 327 virtual gps_provider_error_t resetOdo(void);
apalmieri 0:a77f1f1f8318 328
apalmieri 0:a77f1f1f8318 329 void _InitUART(int br = STD_UART_BAUD);
apalmieri 0:a77f1f1f8318 330 void _ResetFast(Serial *serialDebug = NULL);
apalmieri 0:a77f1f1f8318 331 void _Reset(Serial *serialDebug = NULL);
apalmieri 0:a77f1f1f8318 332 void _SendString(char *buf, int len);
apalmieri 0:a77f1f1f8318 333 int _WakeUp();
apalmieri 0:a77f1f1f8318 334 int _CRC(char *buf, int size);
apalmieri 3:2d568ec8da14 335
apalmieri 0:a77f1f1f8318 336 /**
apalmieri 0:a77f1f1f8318 337 * @brief This function gets a chunck of NMEA messages
apalmieri 0:a77f1f1f8318 338 * @param msg NMEA message to search for
apalmieri 0:a77f1f1f8318 339 * @retval eStatus TESEO_STATUS_SUCCESS if the parse process goes ok, TESEO_FAILURE if it doesn't
apalmieri 0:a77f1f1f8318 340 */
apalmieri 0:a77f1f1f8318 341 eStatus _GetMsg(Teseo::eMsg msg, uint8_t *buffer);
apalmieri 0:a77f1f1f8318 342 /**
apalmieri 0:a77f1f1f8318 343 * @brief This function gets a chunck of PSTM NMEA messages
apalmieri 0:a77f1f1f8318 344 * @param msg PSTM NMEA message to search for
apalmieri 0:a77f1f1f8318 345 * @retval eStatus TESEO_STATUS_SUCCESS if the parse process goes ok, TESEO_FAILURE if it doesn't
apalmieri 0:a77f1f1f8318 346 */
apalmieri 0:a77f1f1f8318 347 void _GetPSTMsg(Teseo::ePSTMsg msg, uint8_t *buffer);
apalmieri 0:a77f1f1f8318 348 void _GetLocationMsg(Teseo::eMsg msg, uint8_t *buffer);
apalmieri 0:a77f1f1f8318 349
apalmieri 0:a77f1f1f8318 350 void _LocLed2Set(void){
apalmieri 0:a77f1f1f8318 351 _loc_led2.write(1);
apalmieri 0:a77f1f1f8318 352 }
apalmieri 0:a77f1f1f8318 353 void _LocLed2Reset(void){
apalmieri 0:a77f1f1f8318 354 _loc_led2.write(0);
apalmieri 0:a77f1f1f8318 355 }
apalmieri 0:a77f1f1f8318 356
apalmieri 0:a77f1f1f8318 357 void outputHandler(uint32_t msgId, uint32_t msgType, tTeseoData *pData);
apalmieri 0:a77f1f1f8318 358 void eventHandler(eTeseoLocEventType event, uint32_t data);
apalmieri 0:a77f1f1f8318 359
apalmieri 0:a77f1f1f8318 360 teseo_app_output_callback appOutCb;
apalmieri 0:a77f1f1f8318 361 teseo_app_event_callback appEventCb;
apalmieri 0:a77f1f1f8318 362
apalmieri 0:a77f1f1f8318 363 MemoryPool<struct _teseoMsg, TESEO_RXQUEUE_LEN> mpool;
apalmieri 0:a77f1f1f8318 364 Queue<struct _teseoMsg, TESEO_RXQUEUE_LEN> queue;
apalmieri 0:a77f1f1f8318 365 };
apalmieri 0:a77f1f1f8318 366
apalmieri 0:a77f1f1f8318 367 #endif /*__TESEO_H__*/