1 /* ----------------------------------------------------------------------------
\r
2 * ATMEL Microcontroller Software Support
\r
3 * ----------------------------------------------------------------------------
\r
4 * Copyright (c) 2008, Atmel Corporation
\r
6 * All rights reserved.
\r
8 * Redistribution and use in source and binary forms, with or without
\r
9 * modification, are permitted provided that the following conditions are met:
\r
11 * - Redistributions of source code must retain the above copyright notice,
\r
12 * this list of conditions and the disclaimer below.
\r
14 * Atmel's name may not be used to endorse or promote products derived from
\r
15 * this software without specific prior written permission.
\r
17 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
\r
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
\r
20 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
\r
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
\r
23 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
\r
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
\r
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
\r
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
27 * ----------------------------------------------------------------------------
\r
33 //------------------------------------------------------------------------------
\r
35 //------------------------------------------------------------------------------
\r
36 #define RTC_HOUR_BIT_LEN_MASK 0x3F
\r
37 #define RTC_MIN_BIT_LEN_MASK 0x7F
\r
38 #define RTC_SEC_BIT_LEN_MASK 0x7F
\r
39 #define RTC_CENT_BIT_LEN_MASK 0x7F
\r
40 #define RTC_YEAR_BIT_LEN_MASK 0xFF
\r
41 #define RTC_MONTH_BIT_LEN_MASK 0x1F
\r
42 #define RTC_DATE_BIT_LEN_MASK 0x3F
\r
43 #define RTC_WEEK_BIT_LEN_MASK 0x07
\r
45 //------------------------------------------------------------------------------
\r
46 // Exported functions
\r
47 //------------------------------------------------------------------------------
\r
49 extern void RTC_SetHourMode(unsigned int mode);
\r
51 extern unsigned int RTC_GetHourMode();
\r
53 extern void RTC_EnableIt(unsigned int sources);
\r
55 extern void RTC_DisableIt(unsigned int sources);
\r
57 extern int RTC_SetTime(
\r
59 unsigned char minute,
\r
60 unsigned char second);
\r
62 extern void RTC_GetTime(
\r
63 unsigned char *pHour,
\r
64 unsigned char *pMinute,
\r
65 unsigned char *pSecond);
\r
67 extern int RTC_SetTimeAlarm(
\r
68 unsigned char *pHour,
\r
69 unsigned char *pMinute,
\r
70 unsigned char *pSecond);
\r
73 unsigned short *pYear,
\r
74 unsigned char *pMonth,
\r
75 unsigned char *pDay,
\r
76 unsigned char *pWeek);
\r
78 extern int RTC_SetDate(
\r
79 unsigned short year,
\r
80 unsigned char month,
\r
82 unsigned char week);
\r
84 extern int RTC_SetDateAlarm(unsigned char *pMonth, unsigned char *pDay);
\r
86 extern void RTC_ClearSCCR(unsigned int mask);
\r
88 extern unsigned int RTC_GetSR(unsigned int mask);
\r
89 #endif //#ifndef RTC_H
\r