1 /*! 2 * @file apm32s10x_rtc.h 3 * 4 * @brief This file contains all the functions prototypes for the RTC firmware library 5 * 6 * @version V1.0.1 7 * 8 * @date 2022-12-31 9 * 10 * @attention 11 * 12 * Copyright (C) 2022-2023 Geehy Semiconductor 13 * 14 * You may not use this file except in compliance with the 15 * GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE). 16 * 17 * The program is only for reference, which is distributed in the hope 18 * that it will be usefull and instructional for customers to develop 19 * their software. Unless required by applicable law or agreed to in 20 * writing, the program is distributed on an "AS IS" BASIS, WITHOUT 21 * ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied. 22 * See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions 23 * and limitations under the License. 24 */ 25 26 /* Define to prevent recursive inclusion */ 27 #ifndef __APM32S10X_RTC_H 28 #define __APM32S10X_RTC_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 /* Includes */ 35 #include "apm32s10x.h" 36 37 /** @addtogroup APM32S10x_StdPeriphDriver 38 @{ 39 */ 40 41 /** @addtogroup RTC_Driver RTC Driver 42 @{ 43 */ 44 45 /** @defgroup RTC_Enumerations Enumerations 46 @{ 47 */ 48 49 typedef enum 50 { 51 RTC_FLAG_OC = 0x0020, /*!< RTC Operation Complete flag */ 52 RTC_FLAG_RSYNC = 0x0008, /*!< Registers Synchronized flag */ 53 RTC_FLAG_OVR = 0x0004, /*!< Overflow flag */ 54 RTC_FLAG_ALR = 0x0002, /*!< Alarm flag */ 55 RTC_FLAG_SEC = 0x0001 /*!< Second flag */ 56 } RTC_FLAG_T; 57 58 typedef enum 59 { 60 RTC_INT_OVR = 0x0004, /*!< Overflow interrupt */ 61 RTC_INT_ALR = 0x0002, /*!< Alarm interrupt */ 62 RTC_INT_SEC = 0x0001 /*!< Second interrupt */ 63 } RTC_INT_T; 64 65 /**@} end of group RTC_Enumerations */ 66 67 /** @defgroup RTC_Functions Functions 68 @{ 69 */ 70 71 /* Operation modes */ 72 void RTC_EnableConfigMode(void); 73 void RTC_DisableConfigMode(void); 74 75 /* Configuration */ 76 uint32_t RTC_ReadCounter(void); 77 void RTC_ConfigCounter(uint32_t value); 78 void RTC_ConfigPrescaler(uint32_t value); 79 void RTC_ConfigAlarm(uint32_t value); 80 uint32_t RTC_ReadDivider(void); 81 void RTC_WaitForLastTask(void); 82 void RTC_WaitForSynchro(void); 83 84 /* Interrupts and flags */ 85 void RTC_EnableInterrupt(uint16_t interrupt); 86 void RTC_DisableInterrupt(uint16_t interrupt); 87 uint8_t RTC_ReadStatusFlag(RTC_FLAG_T flag); 88 void RTC_ClearStatusFlag(uint16_t flag); 89 uint8_t RTC_ReadIntFlag(RTC_INT_T flag); 90 void RTC_ClearIntFlag(uint16_t flag); 91 92 /**@} end of group RTC_Functions */ 93 /**@} end of group RTC_Driver */ 94 /**@} end of group APM32S10x_StdPeriphDriver */ 95 96 #ifdef __cplusplus 97 } 98 #endif 99 100 #endif /* __APM32S10X_RTC_H */ 101