Device driver for the Novatel OEM615 GPS receiver
Oem615.h@3:d55471d8417e, 2013-04-27 (annotated)
- Committer:
- sam_grove
- Date:
- Sat Apr 27 23:10:35 2013 +0000
- Revision:
- 3:d55471d8417e
- Parent:
- 2:35b6eb71a635
updated docs
Who changed what in which revision?
User | Revision | Line number | New 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 | 3:d55471d8417e | 23 | #ifndef OEM615_H |
sam_grove | 3:d55471d8417e | 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 | 3:d55471d8417e | 33 | * #include "mbed.h" |
sam_grove | 3:d55471d8417e | 34 | * |
sam_grove | 3:d55471d8417e | 35 | * int main() |
sam_grove | 3:d55471d8417e | 36 | * { |
sam_grove | 3:d55471d8417e | 37 | * } |
sam_grove | 0:68a9bea384b5 | 38 | * @endcode |
sam_grove | 0:68a9bea384b5 | 39 | */ |
sam_grove | 0:68a9bea384b5 | 40 | |
sam_grove | 0:68a9bea384b5 | 41 | /** |
sam_grove | 0:68a9bea384b5 | 42 | * @class Oem615 |
sam_grove | 0:68a9bea384b5 | 43 | * @brief API abstraction for the OEM615 GPS |
sam_grove | 0:68a9bea384b5 | 44 | */ |
sam_grove | 0:68a9bea384b5 | 45 | class Oem615 |
sam_grove | 0:68a9bea384b5 | 46 | { |
sam_grove | 0:68a9bea384b5 | 47 | public: |
sam_grove | 0:68a9bea384b5 | 48 | |
sam_grove | 0:68a9bea384b5 | 49 | Timer _from_pps; |
sam_grove | 0:68a9bea384b5 | 50 | |
sam_grove | 0:68a9bea384b5 | 51 | /** Create the Adis16488 object |
sam_grove | 0:68a9bea384b5 | 52 | * @param uart - A defined Serial object |
sam_grove | 0:68a9bea384b5 | 53 | * @param rst - A defined DigitalOut object |
sam_grove | 0:68a9bea384b5 | 54 | * @param pwr - A defined DigitalOut object |
sam_grove | 0:68a9bea384b5 | 55 | * @param pps - A defined InterruptIn object |
sam_grove | 0:68a9bea384b5 | 56 | * @param varf - A defined InterruptIn object |
sam_grove | 0:68a9bea384b5 | 57 | */ |
sam_grove | 0:68a9bea384b5 | 58 | Oem615(Serial &uart, DigitalOut &rst, DigitalOut &pwr, InterruptIn &pps, InterruptIn &varf); |
sam_grove | 0:68a9bea384b5 | 59 | |
sam_grove | 0:68a9bea384b5 | 60 | /** Clear state vars and initilize the dependant objects |
sam_grove | 0:68a9bea384b5 | 61 | */ |
sam_grove | 0:68a9bea384b5 | 62 | void init(void); |
sam_grove | 0:68a9bea384b5 | 63 | |
sam_grove | 0:68a9bea384b5 | 64 | /** Allow the module to run and collect user input |
sam_grove | 0:68a9bea384b5 | 65 | */ |
sam_grove | 0:68a9bea384b5 | 66 | void enable(void); |
sam_grove | 0:68a9bea384b5 | 67 | |
sam_grove | 0:68a9bea384b5 | 68 | /** Stop the module and put into low power mode |
sam_grove | 0:68a9bea384b5 | 69 | */ |
sam_grove | 0:68a9bea384b5 | 70 | void disable(void); |
sam_grove | 0:68a9bea384b5 | 71 | |
sam_grove | 0:68a9bea384b5 | 72 | // rx data storage |
sam_grove | 1:12cc9d13cc48 | 73 | #define GPS_RXBUF_SIZE (4096) |
sam_grove | 1:12cc9d13cc48 | 74 | #define GPS_RXBUF_MASK (GPS_RXBUF_SIZE-1) |
sam_grove | 0:68a9bea384b5 | 75 | struct |
sam_grove | 0:68a9bea384b5 | 76 | { |
sam_grove | 0:68a9bea384b5 | 77 | volatile uint32_t loc; |
sam_grove | 1:12cc9d13cc48 | 78 | volatile uint8_t data[GPS_RXBUF_SIZE]; |
sam_grove | 0:68a9bea384b5 | 79 | }_rxbuf; |
sam_grove | 0:68a9bea384b5 | 80 | |
sam_grove | 0:68a9bea384b5 | 81 | private: |
sam_grove | 0:68a9bea384b5 | 82 | Serial *_uart; // tx, rx //OEM615 GPS TX/RX for COM1 on GPS |
sam_grove | 0:68a9bea384b5 | 83 | DigitalOut *_rst; // GPS Reset -- pull high for operation |
sam_grove | 0:68a9bea384b5 | 84 | DigitalOut *_pwr; // reverse logic, 0 = on and 1 = off |
sam_grove | 0:68a9bea384b5 | 85 | InterruptIn *_pps; // replaced original pin p19 that doesnt have InterruptIn capabilites |
sam_grove | 0:68a9bea384b5 | 86 | InterruptIn *_varf; // VARF clock from GPS synched to 1PPS (100 Hz input as IMU command) |
sam_grove | 0:68a9bea384b5 | 87 | |
sam_grove | 0:68a9bea384b5 | 88 | void ppsHandler(void); |
sam_grove | 0:68a9bea384b5 | 89 | void varfHandler(void); |
sam_grove | 0:68a9bea384b5 | 90 | void uartRxHandler(void); |
sam_grove | 0:68a9bea384b5 | 91 | }; |
sam_grove | 0:68a9bea384b5 | 92 | |
sam_grove | 0:68a9bea384b5 | 93 | #endif |
sam_grove | 0:68a9bea384b5 | 94 | |
sam_grove | 0:68a9bea384b5 | 95 | |
sam_grove | 0:68a9bea384b5 | 96 |