1 /**
2     *****************************************************************************
3     * @file     cmem7_rtc.h
4     *
5     * @brief    CMEM7 RTC header file
6     *
7     *
8     * @version  V1.0
9     * @date     3. September 2013
10     *
11     * @note
12     *
13     *****************************************************************************
14     * @attention
15     *
16     * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
17     * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
18     * TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
19     * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
20     * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
21     * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
22     *
23     * <h2><center>&copy; COPYRIGHT 2013 Capital-micro </center></h2>
24     *****************************************************************************
25     */
26 
27 #ifndef __CMEM7_RTC_H
28 #define __CMEM7_RTC_H
29 
30 #ifdef __cplusplus
31  extern "C" {
32 #endif
33 
34 #include "cmem7.h"
35 #include "cmem7_conf.h"
36 
37 /** @defgroup RTC_Int
38   * @{
39   */
40 #define RTC_Int_Second                     ((uint32_t)0x00000001)
41 #define RTC_Int_Millsecond                 ((uint32_t)0x00000002)
42 #define RTC_Int_All                        ((uint32_t)0x00000003)
43 #define IS_RTC_INT(INT)                    (((INT) != 0) && (((INT) & ~RTC_Int_All) == 0))
44 /**
45   * @}
46   */
47 
48 /**
49   * @brief  Enable or disable RTC interrupt.
50     * @param[in] Int interrupt mask bits, which can be the combination of @ref RTC_Int
51     * @param[in] Enable The bit indicates if specific interrupts are enable or not
52   * @retval None
53     */
54 void RTC_ITConfig(uint32_t Int, BOOL Enable);
55 
56 /**
57   * @brief  Check specific interrupts are set or not
58     * @param[in] Int interrupt mask bits, which can be the combination of @ref RTC_Int
59   * @retval BOOL The bit indicates if specific interrupts are set or not
60     */
61 BOOL RTC_GetITStatus(uint32_t Int);
62 
63 /**
64   * @brief  Clear specific interrupts
65     * @param[in] Int interrupt mask bits, which can be the combination of @ref RTC_Int
66   * @retval None
67     */
68 void RTC_ClearITPendingBit(uint32_t Int);
69 
70 /**
71   * @brief  Get seconds since power up
72     * @param    None
73   * @retval uint32_t Seconds since power up
74     */
75 uint32_t RTC_GetSecond(void);
76 
77 /**
78   * @brief  Get current millseconds
79     * @param    None
80   * @retval uint32_t Current millseconds
81     */
82 uint16_t RTC_GetMillSecond(void);
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif /* __CMEM7_RTC_H */
89 
90