This Program is for MAPLE board with OLED and GPS/RTC module. OLED module(OB) : 128 x 128 pixels, 4K color GPS/RTC module(GB) : UP501 These module can buy Marutyu (http://www.marutsu.co.jp)
gpsrtc.h@0:58e40a872950, 2011-06-05 (annotated)
- Committer:
- y_notsu
- Date:
- Sun Jun 05 15:10:48 2011 +0000
- Revision:
- 0:58e40a872950
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
y_notsu | 0:58e40a872950 | 1 | //========================================================= |
y_notsu | 0:58e40a872950 | 2 | // LPC1114 Project |
y_notsu | 0:58e40a872950 | 3 | //========================================================= |
y_notsu | 0:58e40a872950 | 4 | // File Name : gpsrtc.h |
y_notsu | 0:58e40a872950 | 5 | // Function : GPS&RTC Control Header |
y_notsu | 0:58e40a872950 | 6 | //--------------------------------------------------------- |
y_notsu | 0:58e40a872950 | 7 | // Rev.01 2010.08.29 Munetomo Maruyama |
y_notsu | 0:58e40a872950 | 8 | //--------------------------------------------------------- |
y_notsu | 0:58e40a872950 | 9 | // Copyright (C) 2010-2011 Munetomo Maruyama |
y_notsu | 0:58e40a872950 | 10 | //========================================================= |
y_notsu | 0:58e40a872950 | 11 | // ---- License Information ------------------------------- |
y_notsu | 0:58e40a872950 | 12 | // Anyone can FREELY use this code fully or partially |
y_notsu | 0:58e40a872950 | 13 | // under conditions shown below. |
y_notsu | 0:58e40a872950 | 14 | // 1. You may use this code only for individual purpose, |
y_notsu | 0:58e40a872950 | 15 | // and educational purpose. |
y_notsu | 0:58e40a872950 | 16 | // Do not use this code for business even if partially. |
y_notsu | 0:58e40a872950 | 17 | // 2. You should use this code under the GNU GPL. |
y_notsu | 0:58e40a872950 | 18 | // 3. You should remain this header text in your codes |
y_notsu | 0:58e40a872950 | 19 | // including Copyright credit and License Information. |
y_notsu | 0:58e40a872950 | 20 | // 4. Your codes should inherit this license information. |
y_notsu | 0:58e40a872950 | 21 | //========================================================= |
y_notsu | 0:58e40a872950 | 22 | // ---- Patent Notice ------------------------------------- |
y_notsu | 0:58e40a872950 | 23 | // I have not cared whether this system (hw + sw) causes |
y_notsu | 0:58e40a872950 | 24 | // infringement on the patent, copyright, trademark, |
y_notsu | 0:58e40a872950 | 25 | // or trade secret rights of others. You have all |
y_notsu | 0:58e40a872950 | 26 | // responsibilities for determining if your designs |
y_notsu | 0:58e40a872950 | 27 | // and products infringe on the intellectual property |
y_notsu | 0:58e40a872950 | 28 | // rights of others, when you use technical information |
y_notsu | 0:58e40a872950 | 29 | // included in this system for your business. |
y_notsu | 0:58e40a872950 | 30 | //========================================================= |
y_notsu | 0:58e40a872950 | 31 | // ---- Disclaimers --------------------------------------- |
y_notsu | 0:58e40a872950 | 32 | // The function and reliability of this system are not |
y_notsu | 0:58e40a872950 | 33 | // guaranteed. They may cause any damages to loss of |
y_notsu | 0:58e40a872950 | 34 | // properties, data, money, profits, life, or business. |
y_notsu | 0:58e40a872950 | 35 | // By adopting this system even partially, you assume |
y_notsu | 0:58e40a872950 | 36 | // all responsibility for its use. |
y_notsu | 0:58e40a872950 | 37 | //========================================================= |
y_notsu | 0:58e40a872950 | 38 | |
y_notsu | 0:58e40a872950 | 39 | #ifndef __GPSRTC_H__ |
y_notsu | 0:58e40a872950 | 40 | #define __GPSRTC_H__ |
y_notsu | 0:58e40a872950 | 41 | |
y_notsu | 0:58e40a872950 | 42 | #include <type.h> |
y_notsu | 0:58e40a872950 | 43 | |
y_notsu | 0:58e40a872950 | 44 | //============= |
y_notsu | 0:58e40a872950 | 45 | // GPSRTC Data |
y_notsu | 0:58e40a872950 | 46 | //============= |
y_notsu | 0:58e40a872950 | 47 | typedef struct |
y_notsu | 0:58e40a872950 | 48 | { |
y_notsu | 0:58e40a872950 | 49 | uint8_t bGPS_UTC_hour; // UTC hour |
y_notsu | 0:58e40a872950 | 50 | uint8_t bGPS_UTC_min; // UTC minute |
y_notsu | 0:58e40a872950 | 51 | uint8_t bGPS_UTC_sec; // UTC second |
y_notsu | 0:58e40a872950 | 52 | uint8_t cGPS_LAT; // Latitude N or S |
y_notsu | 0:58e40a872950 | 53 | uint8_t bGPS_LAT_deg; // Latitude degree |
y_notsu | 0:58e40a872950 | 54 | uint8_t bGPS_LAT_min; // Latitude minute |
y_notsu | 0:58e40a872950 | 55 | uint8_t bGPS_LAT_sec; // Latitude second |
y_notsu | 0:58e40a872950 | 56 | uint8_t cGPS_LNG; // Longitude E or W |
y_notsu | 0:58e40a872950 | 57 | uint8_t bGPS_LNG_deg; // Longitude degree |
y_notsu | 0:58e40a872950 | 58 | uint8_t bGPS_LNG_min; // Longitude minute |
y_notsu | 0:58e40a872950 | 59 | uint8_t bGPS_LNG_sec; // Longitude second |
y_notsu | 0:58e40a872950 | 60 | uint8_t cGPS_Quality; // GPS Quality (0:Invalid, 1: SPS, 2:D-GPS) |
y_notsu | 0:58e40a872950 | 61 | uint8_t bGPS_Sat; // Satellite Count |
y_notsu | 0:58e40a872950 | 62 | uint8_t bGPS_HDOP_I; // Horizontal Dilution of Precision, Integer |
y_notsu | 0:58e40a872950 | 63 | uint8_t bGPS_HDOP_D; // Horizontal Dilution of Precision, Decimal |
y_notsu | 0:58e40a872950 | 64 | int32_t wGPS_ASL_m; // Altitude above Sea Level in meter |
y_notsu | 0:58e40a872950 | 65 | int32_t wGPS_GEO_m; // Geoid Separation in meter |
y_notsu | 0:58e40a872950 | 66 | // |
y_notsu | 0:58e40a872950 | 67 | uint8_t bRTC_year; // RTC year |
y_notsu | 0:58e40a872950 | 68 | uint8_t bRTC_mon; // RTC month |
y_notsu | 0:58e40a872950 | 69 | uint8_t bRTC_day; // RTC day |
y_notsu | 0:58e40a872950 | 70 | uint8_t bRTC_week; // RTC week |
y_notsu | 0:58e40a872950 | 71 | uint8_t bRTC_hour; // RTC hour |
y_notsu | 0:58e40a872950 | 72 | uint8_t bRTC_min; // RTC minute |
y_notsu | 0:58e40a872950 | 73 | uint8_t bRTC_sec; // RTC second |
y_notsu | 0:58e40a872950 | 74 | } sGPSRTC; |
y_notsu | 0:58e40a872950 | 75 | |
y_notsu | 0:58e40a872950 | 76 | //=================== |
y_notsu | 0:58e40a872950 | 77 | // Define Weekdays |
y_notsu | 0:58e40a872950 | 78 | //=================== |
y_notsu | 0:58e40a872950 | 79 | enum WEEK {SUN = 0, MON, TUE, WED, THU, FRI, SAT}; |
y_notsu | 0:58e40a872950 | 80 | |
y_notsu | 0:58e40a872950 | 81 | //============= |
y_notsu | 0:58e40a872950 | 82 | // Prototypes |
y_notsu | 0:58e40a872950 | 83 | //============= |
y_notsu | 0:58e40a872950 | 84 | uint8_t* Get_Number_from_GPS(uint8_t *pStr, |
y_notsu | 0:58e40a872950 | 85 | int32_t *pInteger, int32_t *pIntrnd, int32_t *pDecimal, uint32_t *pDeclen); |
y_notsu | 0:58e40a872950 | 86 | void Get_GPGGA_Data(sGPSRTC *pG); |
y_notsu | 0:58e40a872950 | 87 | // |
y_notsu | 0:58e40a872950 | 88 | void Init_RTC(uint32_t do_adj, uint8_t year, uint8_t month, uint8_t day, |
y_notsu | 0:58e40a872950 | 89 | uint8_t week, uint8_t hour, uint8_t minute, uint8_t second); |
y_notsu | 0:58e40a872950 | 90 | void Get_RTC_Data(sGPSRTC *psGPSRTC); |
y_notsu | 0:58e40a872950 | 91 | uint8_t *Get_Week_String(uint32_t week); |
y_notsu | 0:58e40a872950 | 92 | // |
y_notsu | 0:58e40a872950 | 93 | void RTC_Write_Reg(uint32_t addr, uint32_t data); |
y_notsu | 0:58e40a872950 | 94 | uint32_t RTC_Read_Reg(uint32_t addr); |
y_notsu | 0:58e40a872950 | 95 | uint8_t BCD_INT(uint8_t num); |
y_notsu | 0:58e40a872950 | 96 | int32_t power(int32_t x, int32_t n); |
y_notsu | 0:58e40a872950 | 97 | uint8_t INT_BCD(uint8_t bcd); |
y_notsu | 0:58e40a872950 | 98 | |
y_notsu | 0:58e40a872950 | 99 | #endif // __GPSRTC_H__ |
y_notsu | 0:58e40a872950 | 100 | |
y_notsu | 0:58e40a872950 | 101 | //========================================================= |
y_notsu | 0:58e40a872950 | 102 | // End of Program |
y_notsu | 0:58e40a872950 | 103 | //========================================================= |