This program is for mbed-Geiger counter system. It use OLED module, GPS module (with RTC), TextLCD, SD FileSystem and some Interrupt pin.

Dependencies:   TextLCD mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers gpsrtc.h Source File

gpsrtc.h

00001 //=========================================================
00002 // LPC1114 Project
00003 //=========================================================
00004 // File Name : gpsrtc.h
00005 // Function  : GPS&RTC Control Header
00006 //---------------------------------------------------------
00007 // Rev.01 2010.08.29 Munetomo Maruyama
00008 //---------------------------------------------------------
00009 // Copyright (C) 2010-2011 Munetomo Maruyama
00010 //=========================================================
00011 // ---- License Information -------------------------------
00012 // Anyone can FREELY use this code fully or partially
00013 // under conditions shown below.
00014 // 1. You may use this code only for individual purpose,
00015 //    and educational purpose.
00016 //    Do not use this code for business even if partially.
00017 // 2. You should use this code under the GNU GPL.
00018 // 3. You should remain this header text in your codes
00019 //   including Copyright credit and License Information.
00020 // 4. Your codes should inherit this license information.
00021 //=========================================================
00022 // ---- Patent Notice -------------------------------------
00023 // I have not cared whether this system (hw + sw) causes
00024 // infringement on the patent, copyright, trademark,
00025 // or trade secret rights of others. You have all
00026 // responsibilities for determining if your designs
00027 // and products infringe on the intellectual property
00028 // rights of others, when you use technical information
00029 // included in this system for your business.
00030 //=========================================================
00031 // ---- Disclaimers ---------------------------------------
00032 // The function and reliability of this system are not
00033 // guaranteed. They may cause any damages to loss of
00034 // properties, data, money, profits, life, or business.
00035 // By adopting this system even partially, you assume
00036 // all responsibility for its use.
00037 //=========================================================
00038 
00039 #ifndef __GPSRTC_H__
00040 #define __GPSRTC_H__
00041 
00042 //#include <type.h>
00043 
00044 //=============
00045 // GPSRTC Data
00046 //=============
00047 typedef struct
00048 {
00049     unsigned char  bGPS_UTC_hour; // UTC hour
00050     unsigned char  bGPS_UTC_min;  // UTC minute
00051     unsigned char  bGPS_UTC_sec;  // UTC second
00052     unsigned char  cGPS_LAT;      // Latitude N or S
00053     unsigned char  bGPS_LAT_deg;  // Latitude degree
00054     unsigned char  bGPS_LAT_min;  // Latitude minute
00055     unsigned char  bGPS_LAT_sec;  // Latitude second
00056     unsigned char  cGPS_LNG;      // Longitude E or W
00057     unsigned char  bGPS_LNG_deg;  // Longitude degree
00058     unsigned char  bGPS_LNG_min;  // Longitude minute
00059     unsigned char  bGPS_LNG_sec;  // Longitude second
00060     unsigned char  cGPS_Quality;  // GPS Quality (0:Invalid, 1: SPS, 2:D-GPS)
00061     unsigned char  bGPS_Sat;      // Satellite Count
00062     unsigned char  bGPS_HDOP_I;   // Horizontal Dilution of Precision, Integer
00063     unsigned char  bGPS_HDOP_D;   // Horizontal Dilution of Precision, Decimal
00064     signed int  wGPS_ASL_m;    // Altitude above Sea Level in meter
00065     signed int  wGPS_GEO_m;    // Geoid Separation in meter
00066     //
00067     unsigned char  bRTC_year; // RTC year
00068     unsigned char  bRTC_mon;  // RTC month
00069     unsigned char  bRTC_day;  // RTC day
00070     unsigned char  bRTC_week; // RTC week
00071     unsigned char  bRTC_hour; // RTC hour
00072     unsigned char  bRTC_min;  // RTC minute
00073     unsigned char  bRTC_sec;  // RTC second
00074 } sGPSRTC;
00075 
00076 //===================
00077 // Define Weekdays
00078 //===================
00079 enum WEEK {SUN = 0, MON, TUE, WED, THU, FRI, SAT};
00080 
00081 //=============
00082 // Prototypes
00083 //=============
00084 unsigned char* Get_Number_from_GPS(unsigned char *pStr,
00085         signed int *pInteger, signed int *pIntrnd, signed int *pDecimal, unsigned int *pDeclen);
00086 void Get_GPGGA_Data(sGPSRTC *pG);
00087 //
00088 void Init_RTC(unsigned int do_adj, unsigned char year, unsigned char month,  unsigned char day,
00089               unsigned char week,    unsigned char hour, unsigned char minute, unsigned char second);
00090 void Get_RTC_Data(sGPSRTC *psGPSRTC);
00091 unsigned char *Get_Week_String(unsigned int week);
00092 //
00093 void RTC_Write_Reg(unsigned int addr, unsigned int data);
00094 unsigned int RTC_Read_Reg(unsigned int addr);
00095 unsigned char BCD_INT(unsigned char num);
00096 signed int power(signed int x, signed int n);
00097 unsigned char INT_BCD(unsigned char bcd);
00098 
00099 #endif // __GPSRTC_H__
00100 
00101 //=========================================================
00102 // End of Program
00103 //=========================================================