rtc_calendar.h

Go to the documentation of this file.
00001 //******************************************************************************
00002 //   Code for application report - "Real Time Clock Library"
00003 //
00004 //   L.Westlund
00005 //   Texas Instruments, Inc
00006 //   August 2005
00007 //******************************************************************************
00008 // THIS PROGRAM IS PROVIDED "AS IS". TI MAKES NO WARRANTIES OR
00009 // REPRESENTATIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
00010 // INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
00011 // FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR
00012 // COMPLETENESS OF RESPONSES, RESULTS AND LACK OF NEGLIGENCE.
00013 // TI DISCLAIMS ANY WARRANTY OF TITLE, QUIET ENJOYMENT, QUIET
00014 // POSSESSION, AND NON-INFRINGEMENT OF ANY THIRD PARTY
00015 // INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE PROGRAM OR
00016 // YOUR USE OF THE PROGRAM.
00017 //
00018 // IN NO EVENT SHALL TI BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
00019 // CONSEQUENTIAL OR INDIRECT DAMAGES, HOWEVER CAUSED, ON ANY
00020 // THEORY OF LIABILITY AND WHETHER OR NOT TI HAS BEEN ADVISED
00021 // OF THE POSSIBILITY OF SUCH DAMAGES, ARISING IN ANY WAY OUT
00022 // OF THIS AGREEMENT, THE PROGRAM, OR YOUR USE OF THE PROGRAM.
00023 // EXCLUDED DAMAGES INCLUDE, BUT ARE NOT LIMITED TO, COST OF
00024 // REMOVAL OR REINSTALLATION, COMPUTER TIME, LABOR COSTS, LOSS
00025 // OF GOODWILL, LOSS OF PROFITS, LOSS OF SAVINGS, OR LOSS OF
00026 // USE OR INTERRUPTION OF BUSINESS. IN NO EVENT WILL TI'S
00027 // AGGREGATE LIABILITY UNDER THIS AGREEMENT OR ARISING OUT OF
00028 // YOUR USE OF THE PROGRAM EXCEED FIVE HUNDRED DOLLARS
00029 // (U.S.$500).
00030 //
00031 // Unless otherwise stated, the Program written and copyrighted
00032 // by Texas Instruments is distributed as "freeware".  You may,
00033 // only under TI's copyright in the Program, use and modify the
00034 // Program without any charge or restriction.  You may
00035 // distribute to third parties, provided that you transfer a
00036 // copy of this license to the third party and the third party
00037 // agrees to these terms by its first use of the Program. You
00038 // must reproduce the copyright notice and any other legend of
00039 // ownership on each copy or partial copy, of the Program.
00040 //
00041 // You acknowledge and agree that the Program contains
00042 // copyrighted material, trade secrets and other TI proprietary
00043 // information and is protected by copyright laws,
00044 // international copyright treaties, and trade secret laws, as
00045 // well as other intellectual property laws.  To protect TI's
00046 // rights in the Program, you agree not to decompile, reverse
00047 // engineer, disassemble or otherwise translate any object code
00048 // versions of the Program to a human-readable form.  You agree
00049 // that in no event will you alter, remove or destroy any
00050 // copyright notice included in the Program.  TI reserves all
00051 // rights not specifically granted under this license. Except
00052 // as specifically provided herein, nothing in this agreement
00053 // shall be construed as conferring by implication, estoppel,
00054 // or otherwise, upon you, any license or other right under any
00055 // TI patents, copyrights or trade secrets.
00056 //
00057 // You may not use the Program in non-TI devices.
00058 //
00059 //******************************************************************************
00060 #ifndef RTC_CALENDAR_H
00061 #define RTC_CALENDAR_H
00062 
00063 #define JANUARY   0x00
00064 #define FEBRUARY  0x01
00065 #define MARCH     0x02
00066 #define APRIL     0x03
00067 #define MAY       0x04
00068 #define JUNE      0x05
00069 #define JULY      0x06
00070 #define AUGUST    0x07
00071 #define SEPTEMBER 0x08
00072 #define OCTOBER   0x09
00073 #define NOVEMBER  0x10
00074 #define DECEMBER  0x11
00075 
00076 #define SUNDAY    0
00077 #define MONDAY    1
00078 #define TUESDAY   2
00079 #define WEDNESDAY 3
00080 #define THURSDAY  4
00081 #define FRIDAY    5
00082 #define SATURDAY  6
00083 
00084 #define NO_DAYLIGHT_SAVINGS 0x00
00085 #define US_DAYLIGHT_SAVINGS 0x01
00086 #define EU_DAYLIGHT_SAVINGS 0x02
00087 
00088 #define setTime(H,M,S,P) {TI_second = S; TI_minute = M; TI_hour = H; TI_PM = P;} // encoded as BCD chars
00089 
00090 extern unsigned char TI_second;      // 0x00 - 0x59
00091 extern unsigned char TI_minute;      // 0x00 - 0x59
00092 extern unsigned char TI_hour;        // 0x00 - 0x12
00093 extern unsigned char TI_day;         // 0x01 - 0x31
00094 extern unsigned char TI_dayOfWeek;   // 0 - 6 .. Sunday = 0
00095 extern unsigned char TI_month;       // 0x00 - 0x11 .. Jan = 0
00096 extern unsigned int  TI_year;        // 0x0000-0x2399 .. leapyears not computed for 0x2400
00097 extern unsigned char TI_PM;          // AM = 0, PM = 1
00098 extern unsigned char TI_FebDays;     // 0x28 or 0x29 depending on leap year
00099 extern unsigned char TI_dayLightZone;// 0x00 = no daylight savings, 0x01 = US daylight, 0x02 = EU daylight
00100 extern unsigned char TI_dayLightSavings; // defines daylight savings in effect. 1 = in effect 0 = not in effect
00101 
00102 extern void incrementSeconds(void);
00103 extern void incrementMinutes(void);
00104 extern void incrementHours(void);
00105 extern void incrementDays(void);
00106 extern void incrementMonths(void);
00107 extern void incrementYears(void);
00108 extern void testLeap(void); // will set FebDays to the appropriate value based on the current year
00109 extern void setDate( int year, char month, char day);  //encoded as decimal numbers with Jan = 1 and 1st day = 1, 31st day = 31
00110 extern char get24Hour(unsigned char hour, unsigned char pm);
00111 
00112 #define LEAP_YEAR (TI_FebDays == 0x29)
00113 
00114 #endif

Generated on Thu Dec 27 14:21:51 2007 for Sample MSP430-449STK2 project by  doxygen 1.5.1