2014-08-23 21:18:49 +00:00
|
|
|
/*
|
|
|
|
* Functions for the UBLOX 6 GPS
|
|
|
|
* Copyright (C) 2014 Richard Meadows <richardeoin>
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GPS_H
|
|
|
|
#define GPS_H
|
|
|
|
|
2015-10-18 17:55:56 +00:00
|
|
|
#include "samd20.h"
|
|
|
|
#include "hw_config.h"
|
|
|
|
|
2014-08-31 06:56:56 +00:00
|
|
|
/**
|
|
|
|
* GPS Error types
|
|
|
|
*/
|
|
|
|
enum gps_error_t {
|
2015-07-16 20:19:35 +00:00
|
|
|
GPS_NOERROR,
|
2014-08-31 06:56:56 +00:00
|
|
|
GPS_ERROR_BAD_CHECKSUM,
|
|
|
|
GPS_ERROR_INVALID_FRAME,
|
|
|
|
};
|
|
|
|
|
2014-10-25 17:26:47 +00:00
|
|
|
void gps_update_time(void);
|
|
|
|
void gps_update_position(void);
|
|
|
|
int gps_update_time_pending(void);
|
|
|
|
int gps_update_position_pending(void);
|
2015-07-16 20:19:35 +00:00
|
|
|
enum gps_error_t gps_get_error_state(void);
|
2014-08-23 21:18:49 +00:00
|
|
|
|
2014-08-30 20:11:35 +00:00
|
|
|
struct ubx_nav_posllh gps_get_nav_posllh();
|
|
|
|
struct ubx_nav_sol gps_get_nav_sol();
|
|
|
|
struct ubx_nav_timeutc gps_get_nav_timeutc();
|
2014-08-23 21:18:49 +00:00
|
|
|
|
2014-10-24 18:33:54 +00:00
|
|
|
uint8_t gps_is_locked(void);
|
2015-10-18 17:55:56 +00:00
|
|
|
|
|
|
|
void gps_set_powersave(bool powersave_on);
|
|
|
|
void gps_set_power_state(bool gnss_running);
|
|
|
|
|
2015-03-16 15:30:36 +00:00
|
|
|
void gps_set_powersave_auto(void);
|
2014-10-24 18:33:54 +00:00
|
|
|
|
2015-10-06 18:27:31 +00:00
|
|
|
void gps_usart_init_enable(uint32_t baud_rate);
|
2015-10-08 20:33:18 +00:00
|
|
|
void gps_reset(void);
|
2014-08-23 21:18:49 +00:00
|
|
|
void gps_init(void);
|
2014-08-30 20:11:35 +00:00
|
|
|
void usart_loopback_test(void);
|
2014-08-23 21:18:49 +00:00
|
|
|
|
|
|
|
#endif /* GPS_H */
|