1 /** 2 ***************************************************************************** 3 * @file cmem7_rtc.c 4 * 5 * @brief CMEM7 RTC source 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>© COPYRIGHT 2013 Capital-micro </center></h2> 24 ***************************************************************************** 25 */ 26 27 #include "cmem7_rtc.h" 28 29 #define SECONDS_IN_A_DAY (86400) 30 RTC_ITConfig(uint32_t Int,BOOL Enable)31void RTC_ITConfig(uint32_t Int, BOOL Enable) { 32 assert_param(IS_RTC_INT(Int)); 33 34 if (Enable) { 35 GLOBAL_CTRL->RTC_INT_EN |= Int; 36 } else { 37 GLOBAL_CTRL->RTC_INT_EN &= ~Int; 38 } 39 } 40 RTC_GetITStatus(uint32_t Int)41BOOL RTC_GetITStatus(uint32_t Int) { 42 assert_param(IS_RTC_INT(Int)); 43 44 if (0 != (RTC->INT_STATUS & Int)) { 45 return TRUE; 46 } 47 48 return FALSE; 49 } 50 RTC_ClearITPendingBit(uint32_t Int)51void RTC_ClearITPendingBit(uint32_t Int) { 52 assert_param(IS_RTC_INT(Int)); 53 54 RTC->INT_STATUS = Int; 55 } 56 RTC_GetSecond()57uint32_t RTC_GetSecond() { 58 return RTC->SECOND; 59 } 60 RTC_GetMillSecond()61uint16_t RTC_GetMillSecond() { 62 return RTC->MILLSECOND_b.MS; 63 } 64