BSP430  20141115
Board Support Package for MSP430 microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
gps.h
Go to the documentation of this file.
1 /* Copyright 2013-2014, Peter A. Bigot
2  *
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * * Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * * Neither the name of the software nor the names of its contributors may be
16  * used to endorse or promote products derived from this software without
17  * specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
66 #ifndef BSP430_UTILITY_GPS_H
67 #define BSP430_UTILITY_GPS_H
68 
69 #include <bsp430/core.h>
70 #include <time.h>
71 
81 #define BSP430_GPS_EPOCH_POSIX 315964800UL
82 
90 #define BSP430_GPS_GPS_UTC_OFFSET_S -16
91 
135 typedef int (* iBSP430gpsSerialCallback_ni) (const uint8_t * msg,
136  size_t len,
137  unsigned long rx_utt);
138 
153 void vBSP430gpsReleaseMessage_ni (const uint8_t * msg);
154 
178 typedef int (* iBSP430gpsPPSCallback_ni) (unsigned long pps_tck);
179 
201 typedef int (* iBSP430gpsTransmitComplete_ni) (const uint8_t * msg,
202  int rc);
203 
205 typedef struct sBSP430gpsConfiguration {
209 
211  unsigned long nmea_baud;
212 
219 
222  unsigned int pps_port_bit;
223 
229 
234 
237  unsigned int pps_ccis;
238 
243 
248 
266  void * devconfigp);
267 
274 int iBSP430gpsShutdown_ni ();
275 
294 int iBSP430gpsExtractTime (const uint8_t * msg,
295  size_t len,
296  struct tm * tmp);
297 
312 
321 void vBSP430gpsGPStoUTCOffset_s_ni (int gps_to_utc_offset_s);
322 
337 time_t xBSP430gpsConvertGPStoUTC_ni (unsigned int weekno,
338  unsigned long sow);
339 
358 int iBSP430gpsTransmit_ni (const uint8_t * msg,
359  size_t len,
360  iBSP430gpsTransmitComplete_ni complete_cb);
361 
362 #endif /* BSP430_UTILITY_GPS_H */
struct sBSP430gpsConfiguration sBSP430gpsConfiguration
void vBSP430gpsGPStoUTCOffset_s_ni(int gps_to_utc_offset_s)
void vBSP430gpsReleaseMessage_ni(const uint8_t *msg)
tBSP430periphHandle pps_timer
Definition: gps.h:228
int(* iBSP430gpsTransmitComplete_ni)(const uint8_t *msg, int rc)
Definition: gps.h:201
int(* iBSP430gpsPPSCallback_ni)(unsigned long pps_tck)
Definition: gps.h:178
int pps_ccidx
Definition: gps.h:233
Common header included by all BSP430 leaf headers.
time_t xBSP430gpsConvertGPStoUTC_ni(unsigned int weekno, unsigned long sow)
unsigned long nmea_baud
Definition: gps.h:211
iBSP430gpsPPSCallback_ni pps_cb
Definition: gps.h:246
iBSP430gpsSerialCallback_ni serial_cb
Definition: gps.h:242
Definition: gps.h:205
tBSP430periphHandle nmea_serial
Definition: gps.h:208
int iBSP430gpsGPStoUTCOffset_s_ni(void)
int iBSP430gpsTransmit_ni(const uint8_t *msg, size_t len, iBSP430gpsTransmitComplete_ni complete_cb)
unsigned int pps_port_bit
Definition: gps.h:222
tBSP430periphHandle pps_port
Definition: gps.h:218
int iBSP430gpsShutdown_ni()
int tBSP430periphHandle
Definition: periph.h:106
int iBSP430gpsInitialize_ni(const sBSP430gpsConfiguration *configp, void *devconfigp)
int(* iBSP430gpsSerialCallback_ni)(const uint8_t *msg, size_t len, unsigned long rx_utt)
Definition: gps.h:135
unsigned int pps_ccis
Definition: gps.h:237