Device driver for the Novatel OEM615 GPS receiver

Committer:
sam_grove
Date:
Wed Apr 10 06:23:24 2013 +0000
Revision:
1:12cc9d13cc48
Parent:
0:68a9bea384b5
Child:
2:35b6eb71a635
minimum working to generate log data

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sam_grove 0:68a9bea384b5 1 /**
sam_grove 0:68a9bea384b5 2 * @file Oem615.h
sam_grove 0:68a9bea384b5 3 * @brief Device driver - Novatel OEM615 GPS
sam_grove 0:68a9bea384b5 4 * @author sam grove
sam_grove 0:68a9bea384b5 5 * @version 1.0
sam_grove 0:68a9bea384b5 6 * @see http://www.novatel.com/support/firmware-software-and-manuals/product-manuals-and-doc-updates/oem6-family/
sam_grove 0:68a9bea384b5 7 *
sam_grove 0:68a9bea384b5 8 * Copyright (c) 2013
sam_grove 0:68a9bea384b5 9 *
sam_grove 0:68a9bea384b5 10 * Licensed under the Apache License, Version 2.0 (the "License");
sam_grove 0:68a9bea384b5 11 * you may not use this file except in compliance with the License.
sam_grove 0:68a9bea384b5 12 * You may obtain a copy of the License at
sam_grove 0:68a9bea384b5 13 *
sam_grove 0:68a9bea384b5 14 * http://www.apache.org/licenses/LICENSE-2.0
sam_grove 0:68a9bea384b5 15 *
sam_grove 0:68a9bea384b5 16 * Unless required by applicable law or agreed to in writing, software
sam_grove 0:68a9bea384b5 17 * distributed under the License is distributed on an "AS IS" BASIS,
sam_grove 0:68a9bea384b5 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
sam_grove 0:68a9bea384b5 19 * See the License for the specific language governing permissions and
sam_grove 0:68a9bea384b5 20 * limitations under the License.
sam_grove 0:68a9bea384b5 21 */
sam_grove 0:68a9bea384b5 22
sam_grove 0:68a9bea384b5 23 #ifndef OEM615_H
sam_grove 0:68a9bea384b5 24 #define OEM615_H
sam_grove 0:68a9bea384b5 25
sam_grove 0:68a9bea384b5 26 #include "LogUtil.h"
sam_grove 0:68a9bea384b5 27 #include "mbed.h"
sam_grove 0:68a9bea384b5 28
sam_grove 0:68a9bea384b5 29 /** Using the Novatel OEM615
sam_grove 0:68a9bea384b5 30 *
sam_grove 0:68a9bea384b5 31 * Example:
sam_grove 0:68a9bea384b5 32 * @code
sam_grove 0:68a9bea384b5 33
sam_grove 0:68a9bea384b5 34 * @endcode
sam_grove 0:68a9bea384b5 35 */
sam_grove 0:68a9bea384b5 36
sam_grove 0:68a9bea384b5 37 /**
sam_grove 0:68a9bea384b5 38 * @class Oem615
sam_grove 0:68a9bea384b5 39 * @brief API abstraction for the OEM615 GPS
sam_grove 0:68a9bea384b5 40 */
sam_grove 0:68a9bea384b5 41 class Oem615
sam_grove 0:68a9bea384b5 42 {
sam_grove 0:68a9bea384b5 43 public:
sam_grove 0:68a9bea384b5 44
sam_grove 0:68a9bea384b5 45 Timer _from_pps;
sam_grove 0:68a9bea384b5 46
sam_grove 0:68a9bea384b5 47 /** Create the Adis16488 object
sam_grove 0:68a9bea384b5 48 * @param uart - A defined Serial object
sam_grove 0:68a9bea384b5 49 * @param rst - A defined DigitalOut object
sam_grove 0:68a9bea384b5 50 * @param pwr - A defined DigitalOut object
sam_grove 0:68a9bea384b5 51 * @param pps - A defined InterruptIn object
sam_grove 0:68a9bea384b5 52 * @param varf - A defined InterruptIn object
sam_grove 0:68a9bea384b5 53 */
sam_grove 0:68a9bea384b5 54 Oem615(Serial &uart, DigitalOut &rst, DigitalOut &pwr, InterruptIn &pps, InterruptIn &varf);
sam_grove 0:68a9bea384b5 55
sam_grove 0:68a9bea384b5 56 /** Clear state vars and initilize the dependant objects
sam_grove 0:68a9bea384b5 57 */
sam_grove 0:68a9bea384b5 58 void init(void);
sam_grove 0:68a9bea384b5 59
sam_grove 0:68a9bea384b5 60 /** Allow the module to run and collect user input
sam_grove 0:68a9bea384b5 61 */
sam_grove 0:68a9bea384b5 62 void enable(void);
sam_grove 0:68a9bea384b5 63
sam_grove 0:68a9bea384b5 64 /** Stop the module and put into low power mode
sam_grove 0:68a9bea384b5 65 */
sam_grove 0:68a9bea384b5 66 void disable(void);
sam_grove 0:68a9bea384b5 67
sam_grove 0:68a9bea384b5 68 // rx data storage
sam_grove 1:12cc9d13cc48 69 #define GPS_RXBUF_SIZE (4096)
sam_grove 1:12cc9d13cc48 70 #define GPS_RXBUF_MASK (GPS_RXBUF_SIZE-1)
sam_grove 0:68a9bea384b5 71 struct
sam_grove 0:68a9bea384b5 72 {
sam_grove 0:68a9bea384b5 73 volatile uint32_t loc;
sam_grove 1:12cc9d13cc48 74 volatile uint8_t data[GPS_RXBUF_SIZE];
sam_grove 0:68a9bea384b5 75 }_rxbuf;
sam_grove 0:68a9bea384b5 76
sam_grove 0:68a9bea384b5 77 private:
sam_grove 0:68a9bea384b5 78 Serial *_uart; // tx, rx //OEM615 GPS TX/RX for COM1 on GPS
sam_grove 0:68a9bea384b5 79 DigitalOut *_rst; // GPS Reset -- pull high for operation
sam_grove 0:68a9bea384b5 80 DigitalOut *_pwr; // reverse logic, 0 = on and 1 = off
sam_grove 0:68a9bea384b5 81 // DigitalIn *_pps; // initial 1PPS DIO -- revised because this pin isnt interruptable
sam_grove 0:68a9bea384b5 82 InterruptIn *_pps; // replaced original pin p19 that doesnt have InterruptIn capabilites
sam_grove 0:68a9bea384b5 83 InterruptIn *_varf; // VARF clock from GPS synched to 1PPS (100 Hz input as IMU command)
sam_grove 0:68a9bea384b5 84
sam_grove 0:68a9bea384b5 85 void ppsHandler(void);
sam_grove 0:68a9bea384b5 86 void varfHandler(void);
sam_grove 0:68a9bea384b5 87 void uartRxHandler(void);
sam_grove 0:68a9bea384b5 88 };
sam_grove 0:68a9bea384b5 89
sam_grove 0:68a9bea384b5 90 #endif
sam_grove 0:68a9bea384b5 91
sam_grove 0:68a9bea384b5 92
sam_grove 0:68a9bea384b5 93