apm32f0xx_rtc.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. /*!
  2. * @file apm32f0xx_rtc.h
  3. *
  4. * @brief This file contains all the functions prototypes for the RTC firmware library.
  5. *
  6. * @version V1.0.2
  7. *
  8. * @date 2022-02-21
  9. *
  10. * @attention
  11. *
  12. * Copyright (C) 2020-2022 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 useful 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. #ifndef __APM32F0XX_RTC_H
  26. #define __APM32F0XX_RTC_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #include "apm32f0xx.h"
  31. /** @addtogroup APM32F0xx_StdPeriphDriver
  32. @{
  33. */
  34. /** @addtogroup RTC_Driver RTC Driver
  35. @{
  36. */
  37. /** @defgroup RTC_Macros Macros
  38. @{
  39. */
  40. /**@} end of group RTC_Macros */
  41. /** @defgroup RTC_Enumerations Enumerations
  42. @{
  43. */
  44. /**
  45. * @brief RTC Hour Formats
  46. */
  47. typedef enum
  48. {
  49. RTC_HourFormat_24, /*!< 24 hour/day format */
  50. RTC_HourFormat_12 /*!< AM/PM hour format */
  51. } RTC_HOUR_FORMAT_T;
  52. /**
  53. * @brief RTC Input parameter format
  54. */
  55. typedef enum
  56. {
  57. RTC_FORMAT_BIN, /*!< Format in BIN */
  58. RTC_FORMAT_BCD /*!< Format in BCD */
  59. } RTC_FORMAT_T;
  60. /**
  61. * @brief RTC_AM_PM
  62. */
  63. typedef enum
  64. {
  65. RTC_H12_AM, /*!< Set RTC time to AM */
  66. RTC_H12_PM /*!< Set RTC time to PM */
  67. } RTC_H12_T;
  68. /**
  69. * @brief RTC DayLightSaving
  70. */
  71. typedef enum
  72. {
  73. RTC_DLS_SUB1H, /*!< Winter time change */
  74. RTC_DLS_ADD1H /*!< Summer time change */
  75. } RTC_DAYLIGHT_SAVING_T;
  76. /**
  77. * @brief RTC DayLightSaving
  78. */
  79. typedef enum
  80. {
  81. RTC_SO_RESET = BIT_RESET, /*!< Reset backup value */
  82. RTC_SO_SET = BIT_SET, /*!< Set backup value */
  83. } RTC_STORE_OPERATION_T;
  84. /**
  85. * @brief RTC Output selection
  86. */
  87. typedef enum
  88. {
  89. RTC_OPSEL_DISABLE = 0x00, /*!< output disable */
  90. RTC_OPSEL_ALARMA = 0x01, /*!< alarma output enable */
  91. RTC_OPSEL_WAKEUP = 0x03, /*!< Only for APM32F072 and APM32F091 devices */
  92. } RTC_OPSEL_T;
  93. /**
  94. * @brief RTC Output Polarity
  95. */
  96. typedef enum
  97. {
  98. RTC_OPP_HIGH, /*!< output polarity is high */
  99. RTC_OPP_LOW /*!< output polarity is low */
  100. } RTC_OPP_T;
  101. /**
  102. * @brief RTC Calib Output selection
  103. */
  104. typedef enum
  105. {
  106. RTC_CALIBOUTPUT_512Hz, /*!< calib output is 512Hz */
  107. RTC_CALIBOUTPUT_1Hz /*!< calib output is 1Hz */
  108. } RTC_CALIB_OUTPUT_T;
  109. /**
  110. * @brief RTC Smooth calib period
  111. */
  112. typedef enum
  113. {
  114. RTC_SCP_16SEC, /*!<The smooth calibration periode is 16 */
  115. RTC_SCP_8SEC /*!<The smooth calibration periode is 8 */
  116. } RTC_SCP_T;
  117. /**
  118. * @brief RTC Smooth calib period
  119. */
  120. typedef enum
  121. {
  122. RTC_SCPP_RESET, /*!< Add one RTCCLK puls every 2**11 pulses */
  123. RTC_SCPP_SET /*!< No RTCCLK pulses are added */
  124. } RTC_SCPP_T;
  125. /**
  126. * @brief RTC Time Stamp Edges
  127. */
  128. typedef enum
  129. {
  130. RTC_TIME_STAMPEDGE_RISING, /*!< event occurs on the rising edge */
  131. RTC_TIME_STAMPEDGE_FALLING /*!< event occurs on the falling edge */
  132. } RTC_TIMESTAMP_EDGE_T;
  133. /**
  134. * @brief RTC Tamper Trigger
  135. */
  136. typedef enum
  137. {
  138. RTC_TAMPER_TRIGGER_RISINGEDGE = 0x00, /*!< Rising Edge of the tamper pin causes tamper event */
  139. RTC_TAMPER_TRIGGER_FALLINGEDGE = 0x01, /*!< Falling Edge of the tamper pin causes tamper event */
  140. RTC_TAMPER_TRIGGER_LOWLEVEL = 0x00, /*!< Low Level of the tamper pin causes tamper event */
  141. RTC_TAMPER_TRIGGER_HIGHLEVEL = 0x01 /*!< High Level of the tamper pin causes tamper event */
  142. } RTC_TAMPER_TRIGGER_T;
  143. /**
  144. * @brief RTC Tamper Pins
  145. */
  146. typedef enum
  147. {
  148. RTC_TAMPER_1, /*!< Select Tamper 1 */
  149. RTC_TAMPER_2, /*!< Select Tamper 1 */
  150. RTC_TAMPER_3 /*!< Only for APM32F072 and APM32F091 devices */
  151. } RTC_TAMPER_T;
  152. /**
  153. * @brief Tampers Sampling Frequency
  154. */
  155. typedef enum
  156. {
  157. RTC_TAMPER_FILTER_DISABLE, /*!< Tamper filter is disabled */
  158. RTC_TAMPER_FILTER_2SAMPLE, /*!< Tamper is activated after 2 consecutive samples at the active level */
  159. RTC_TAMPER_FILTER_4SAMPLE, /*!< Tamper is activated after 4 consecutive samples at the active level */
  160. RTC_TAMPER_FILTER_8SAMPLE /*!< Tamper is activated after 8 consecutive samples at the active level */
  161. } RTC_TAMPER_FILTER_T;
  162. /**
  163. * @brief Tampers Sampling Frequency
  164. */
  165. typedef enum
  166. {
  167. RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV32768, /*!< Tampers Sampling Frequency = RTC_CLK / 32768 */
  168. RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV16384, /*!< Tampers Sampling Frequency = RTC_CLK / 16384 */
  169. RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV8192, /*!< Tampers Sampling Frequency = RTC_CLK / 8192 */
  170. RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV4096, /*!< Tampers Sampling Frequency = RTC_CLK / 4096 */
  171. RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV2048, /*!< Tampers Sampling Frequency = RTC_CLK / 2048 */
  172. RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV1024, /*!< Tampers Sampling Frequency = RTC_CLK / 1024 */
  173. RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV512, /*!< Tampers Sampling Frequency = RTC_CLK / 512 */
  174. RTC_TAMPERSAMPLINGFREQ_RTCCLK_DIV256 /*!< Tampers Sampling Frequency = RTC_CLK / 256 */
  175. } RTC_TAMPER_SAMPLING_FREQ_T;
  176. /**
  177. * @brief Precharge Duration
  178. */
  179. typedef enum
  180. {
  181. RTC_PRECHARGEDURATION_1RTCCLK, /*!< Duration is 1 RTCCLK cycle */
  182. RTC_PRECHARGEDURATION_2RTCCLK, /*!< Duration is 2 RTCCLK cycle */
  183. RTC_PRECHARGEDURATION_4RTCCLK, /*!< Duration is 4 RTCCLK cycle */
  184. RTC_PRECHARGEDURATION_8RTCCLK /*!< Duration is 8 RTCCLK cycle */
  185. } RTC_PRECHARGE_DURATION_T;
  186. /**
  187. * @brief RTC Add 1 Second Parameter
  188. */
  189. typedef enum
  190. {
  191. RTC_SHIFTADD1S_RESET, /*!< No effect */
  192. RTC_SHIFTADD1S_SET /*!< Add one second to the clock calendar */
  193. } RTC_SHIFT_ADD1S_T;
  194. /**
  195. * @brief
  196. */
  197. typedef enum
  198. {
  199. RTC_OPENDRAIN, /*!< RTC Output is configured in Open Drain mode */
  200. RTC_PUSHPULL /*!< RTC Output is configured in Push Pull mode */
  201. } RTC_OUTPUT_T;
  202. /**
  203. * @brief RTC AlarmDateWeekDay
  204. */
  205. typedef enum
  206. {
  207. RTC_WEEKDAY_SEL_DATE, /*!< Select DAYU to represent the date */
  208. RTC_WEEKDAY_SEL_WEEKDAY /*!< Select DAYU to represent the weekday */
  209. } RTC_WEEKDAY_SEL_T;
  210. /**
  211. * @brief RTC Interrupts Soure
  212. */
  213. typedef enum
  214. {
  215. RTC_INT_ALR = 0x00001000, /*!< ALRMA A interrupt mask */
  216. RTC_INT_WT = 0x00004000, /*!< WakeUp Timer interrupt mask (It's only for APM32F091 devices) */
  217. RTC_INT_TS = 0x00008000, /*!< Time Stamp interrupt mask */
  218. RTC_INT_TAMP = 0x00000004, /*!< Tamper event interrupt mask */
  219. } RTC_INT_T;
  220. /**
  221. * @brief RTC Interrupts Flag
  222. */
  223. typedef enum
  224. {
  225. RTC_INT_FLAG_ALR = 0x00001000, /*!< ALRMA interrupt */
  226. RTC_INT_FLAG_WT = 0x00004000, /*!< WakeUp Timer (It's only for APM32F072 and APM32F091 devices) */
  227. RTC_INT_FLAG_TS = 0x00008000, /*!< Time Stamp interrupt mask */
  228. RTC_INT_FLAG_TAMP1 = 0x00020004, /*!< Tamper1 event interrupt mask */
  229. RTC_INT_FLAG_TAMP2 = 0x00040004, /*!< Tamper2 event interrupt mask */
  230. RTC_INT_FLAG_TAMP3 = 0x00080004, /*!< Tamper3 event interrupt mask, only for APM32F072 and APM32F091 device */
  231. } RTC_INT_FLAG_T;
  232. /**
  233. * @brief RTC flag
  234. */
  235. typedef enum
  236. {
  237. RTC_FLAG_AWF = BIT0, /*!< Alarm Write Flag */
  238. RTC_FLAG_WTWF = BIT2, /*!< Wakeup Timer Write Flag, Only for APM32F072 and APM32F091 devices */
  239. RTC_FLAG_SOPF = BIT3, /*!< Shift Operation Pending Flag */
  240. RTC_FLAG_ISF = BIT4, /*!< Initialization State Flag */
  241. RTC_FLAG_RSF = BIT5, /*!< Registers Synchronization Flag */
  242. RTC_FLAG_INTF = BIT6, /*!< Register Initialization Flag */
  243. RTC_FLAG_ALRF = BIT8, /*!< Alarm Match Flag */
  244. RTC_FLAG_WTF = BIT10, /*!< Wakeup Timer Flag, only for APM32F072 and APM32F091 devices */
  245. RTC_FLAG_TSF = BIT11, /*!< Time Stamp Flag */
  246. RTC_FLAG_TSOF = BIT12, /*!< Time Stamp Overflow Flag */
  247. RTC_FLAG_TP1F = BIT13, /*!< Tamper 1 event Detection Flag */
  248. RTC_FLAG_TP2F = BIT14, /*!< Tamper 2 event Detection Flag */
  249. RTC_FLAG_TP3F = BIT15, /*!< Tamper 3 event Detection Flag, only for APM32F072 and APM32F091 devices */
  250. RTC_FLAG_RPF = BIT16, /*!< Recalibration Pending Flag */
  251. } RTC_FLAG_T;
  252. /**
  253. * @brief RTC_Backup
  254. */
  255. typedef enum
  256. {
  257. RTC_BAKP_DATA0, /*!< set Backup data0 */
  258. RTC_BAKP_DATA1, /*!< set Backup data1 */
  259. RTC_BAKP_DATA2, /*!< set Backup data2 */
  260. RTC_BAKP_DATA3, /*!< set Backup data3 */
  261. RTC_BAKP_DATA4 /*!< set Backup data4 */
  262. } RTC_BAKP_DATA_T;
  263. /**
  264. * @brief RTC_AlarmMask
  265. */
  266. typedef enum
  267. {
  268. RTC_MASK_NONE = 0x00000000, /*!< No mask */
  269. RTC_MASK_DATEWEEK = (int)0x80000000, /*!< Dateweek mask */
  270. RTC_MASK_HOURS = 0x00800000, /*!< Hours mask */
  271. RTC_MASK_MINUTES = 0x00008000, /*!< Minutes mask */
  272. RTC_MASK_SECONDS = 0x00000080, /*!< Seconds mask */
  273. RTC_MASK_ALL = (int)0x80808080, /*!< ALL mask */
  274. } RTC_MASK_T;
  275. /**
  276. * @brief RTC Wakeup clock select (only APM32F072 and APM32F091 devices)
  277. */
  278. typedef enum
  279. {
  280. RTC_WAKEUP_CLOCK_RTCDIV16 = 0x00, /*!< Wakeup Clock select to RTC/16 */
  281. RTC_WAKEUP_CLOCK_RTCDIV8, /*!< Wakeup Clock select to RTC/8 */
  282. RTC_WAKEUP_CLOCK_RTCDIV4, /*!< Wakeup Clock select to RTC/4 */
  283. RTC_WAKEUP_CLOCK_RTCDIV2, /*!< Wakeup Clock select to RTC/2 */
  284. RTC_WAKEUP_CLOCK_CK_SPRE_16B, /*!< Wakeup Clock select to clk_spre */
  285. RTC_WAKEUP_CLOCK_CK_SPRE_17B, /*!< Wakeup Clock select to clk_spre */
  286. } RTC_WAKEUP_CLOCK_T;
  287. /**@} end of group RTC_Enumerations*/
  288. /** @addtogroup RTC_Macros Macros
  289. @{
  290. */
  291. /** Macros description */
  292. #define RTC_INITMODE_TIMEOUT ((uint32_t) 0x00004000)
  293. #define RTC_SYNCHRO_TIMEOUT ((uint32_t) 0x00008000)
  294. #define RTC_RECALPF_TIMEOUT ((uint32_t) 0x00001000)
  295. #define RTC_SHPF_TIMEOUT ((uint32_t) 0x00001000)
  296. #define RTC_CTRL_INT ((uint32_t) 0x0000D000)
  297. #define RTC_TAFCFG_INT ((uint32_t) 0x00000004)
  298. #define RTC_CTRL_INT ((uint32_t) 0x0000D000)
  299. #define RTC_TAFCFG_INT ((uint32_t) 0x00000004)
  300. #define RTC_MONTH_JANUARY ((uint8_t)0x01)
  301. #define RTC_MONTH_FEBRUARY ((uint8_t)0x02)
  302. #define RTC_MONTH_MARCH ((uint8_t)0x03)
  303. #define RTC_MONTH_APRIL ((uint8_t)0x04)
  304. #define RTC_MONTH_MAY ((uint8_t)0x05)
  305. #define RTC_MONTH_JUNE ((uint8_t)0x06)
  306. #define RTC_MONTH_JULY ((uint8_t)0x07)
  307. #define RTC_MONTH_AUGUST ((uint8_t)0x08)
  308. #define RTC_MONTH_SEPTEMBER ((uint8_t)0x09)
  309. #define RTC_MONTH_OCTOBER ((uint8_t)0x0A)
  310. #define RTC_MONTH_NOVEMBER ((uint8_t)0x0B)
  311. #define RTC_MONTH_DECEMBER ((uint8_t)0x0C)
  312. #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01)
  313. #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02)
  314. #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03)
  315. #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04)
  316. #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05)
  317. #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06)
  318. #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x07)
  319. /**@} end of group RTC_Macros*/
  320. /** @defgroup RTC_Enumerations Enumerations
  321. @{
  322. */
  323. /**@} end of group RTC_Enumerations */
  324. /** @defgroup RTC_Structures Structures
  325. @{
  326. */
  327. /**
  328. * @brief RTC Init structures definition
  329. */
  330. typedef struct
  331. {
  332. RTC_HOUR_FORMAT_T format; /*!< RTC hour formats selection */
  333. uint32_t AsynchPrediv; /*!< Asynchronous prescaler coefficient setting */
  334. uint32_t SynchPrediv; /*!< Synchronous prescaler coefficient setting */
  335. } RTC_Config_T;
  336. /**
  337. * @brief RTC Time structure definition
  338. */
  339. typedef struct
  340. {
  341. uint8_t hours; /*!< Set hours of RTC time */
  342. uint8_t minutes; /*!< Set minutes of RTC time */
  343. uint8_t seconds; /*!< Set seconds of RTC time */
  344. uint8_t H12; /*!< Set RTC time to AM or PM */
  345. } RTC_TIME_T;
  346. /**
  347. * @brief RTC Date structure definition
  348. */
  349. typedef struct
  350. {
  351. uint8_t weekday; /*!< Set weekday of RTC date */
  352. uint8_t month; /*!< Set month of RTC date */
  353. uint8_t date; /*!< Set data of RTC date */
  354. uint8_t year; /*!< Set year of RTC date */
  355. } RTC_DATE_T;
  356. /**
  357. * @brief RTC ALRMA structure definition
  358. */
  359. typedef struct
  360. {
  361. RTC_TIME_T time; /*!< Set RTC time */
  362. uint32_t AlarmMask; /*!< Set alarm mask */
  363. RTC_WEEKDAY_SEL_T AlarmDateWeekDaySel; /*!< Set weekday's DAYU of alarm date */
  364. uint8_t AlarmDateWeekDay; /*!< Set weekday of alarm date */
  365. } RTC_ALARM_T;
  366. /**@} end of group RTC_Structures*/
  367. /** @defgroup RTC_Variables Variables
  368. @{
  369. */
  370. /**@} end of group RTC_Variables */
  371. /** @defgroup RTC_Fuctions Fuctions
  372. @{
  373. */
  374. /** Initialization and Configuration functions */
  375. uint8_t RTC_Reset(void);
  376. uint8_t RTC_Config(RTC_Config_T* Struct);
  377. void RTC_ConfigStructInit(RTC_Config_T* Struct);
  378. void RTC_EnableWriteProtection(void);
  379. void RTC_DisableWriteProtection(void);
  380. uint8_t RTC_EnableInit(void);
  381. void RTC_DisableInit(void);
  382. uint8_t RTC_WaitForSynchro(void);
  383. uint8_t RTC_EnableRefClock(void);
  384. uint8_t RTC_DisableRefClock(void);
  385. void RTC_EnableBypassShadow(void);
  386. void RTC_DisableBypassShadow(void);
  387. /** Time and Date configuration functions */
  388. uint8_t RTC_ConfigTime(RTC_FORMAT_T format, RTC_TIME_T* timeStruct);
  389. void RTC_ConfigTimeStructInit(RTC_TIME_T* timeStruct);
  390. void RTC_ReadTime(RTC_FORMAT_T format, RTC_TIME_T* timeStruct);
  391. uint32_t RTC_ReadSubSecond(void);
  392. uint8_t RTC_ConfigDate(RTC_FORMAT_T format, RTC_DATE_T* dateStruct);
  393. void RTC_ConfigDateStructInit(RTC_DATE_T* dateStruct);
  394. void RTC_ReadDate(RTC_FORMAT_T format, RTC_DATE_T* dateStruct);
  395. /** Alarms (ALRMA A) configuration functions */
  396. void RTC_ConfigAlarm(RTC_FORMAT_T format, RTC_ALARM_T* alarmStruct);
  397. void RTC_ConfigAlarmStructInit(RTC_ALARM_T* alarmStruct);
  398. void RTC_ReadAlarm(RTC_FORMAT_T format, RTC_ALARM_T* alarmStruct);
  399. void RTC_EnableAlarm(void);
  400. uint8_t RTC_DisableAlarm(void);
  401. void RTC_ConfigAlarmSubSecond(uint32_t val, uint8_t mask);
  402. uint32_t RTC_ReadAlarmSubSecond(void);
  403. /** WakeUp Timer configuration functions */
  404. void RTC_ConfigWakeUpClock(RTC_WAKEUP_CLOCK_T wakeUpClock); //!< Only for APM32F072 and APM32F091 devices
  405. void RTC_SetWakeUpValue(uint32_t wakeUpValue); //!< Only for APM32F072 and APM32F091 devices
  406. uint32_t RTC_ReadWakeUpValue(void); //!< Only for APM32F072 and APM32F091 devices
  407. void RTC_EnableWakeUp(void); //!< Only for APM32F072 and APM32F091 devices
  408. uint8_t RTC_DisableWakeUp(void); //!< Only for APM32F072 and APM32F091 devices
  409. /** Daylight Saving configuration functions */
  410. void RTC_ConfigDayLightSaving(RTC_DAYLIGHT_SAVING_T sav, RTC_STORE_OPERATION_T bit);
  411. uint32_t RTC_ReadStoreOperation(void);
  412. /** Output pin Configuration function */
  413. void RTC_ConfigOutput(RTC_OPSEL_T opsel, RTC_OPP_T opp);
  414. /** Digital Calibration configuration functions */
  415. void RTC_EnableCalibOutput(void);
  416. void RTC_DisableCalibOutput(void);
  417. void RTC_ConfigCalibOutput(RTC_CALIB_OUTPUT_T calib);
  418. uint8_t RTC_ConfigSmoothCalib(RTC_SCP_T period, RTC_SCPP_T bit, uint32_t value);
  419. /** TimeStamp configuration functions */
  420. void RTC_EnableTimeStamp(RTC_TIMESTAMP_EDGE_T edge);
  421. void RTC_DisableTimeStamp(RTC_TIMESTAMP_EDGE_T edge);
  422. void RTC_ReadTimeDate(RTC_FORMAT_T format, RTC_TIME_T* timeStruct,
  423. RTC_DATE_T* dateStruct);
  424. uint32_t RTC_ReadTimeStampSubSecond(void);
  425. /** Tampers configuration functions */
  426. void RTC_ConfigTamperTrigger(RTC_TAMPER_T tamper, RTC_TAMPER_TRIGGER_T trigger);
  427. void RTC_EnableTamper(RTC_TAMPER_T tamper);
  428. void RTC_DisableTamper(RTC_TAMPER_T tamper);
  429. void RTC_ConfigFilter(RTC_TAMPER_FILTER_T filter);
  430. void RTC_ConfigSamplingFreq(RTC_TAMPER_SAMPLING_FREQ_T freq);
  431. void RTC_PinsPrechargeDuration(RTC_PRECHARGE_DURATION_T duration);
  432. void RTC_EnableTDE(void);
  433. void RTC_DisableTDE(void);
  434. void RTC_EnablePullUp(void);
  435. void RTC_DisablePullUp(void);
  436. /** Backup Data Registers configuration functions */
  437. void RTC_WriteBackup(RTC_BAKP_DATA_T backup, uint32_t data);
  438. uint32_t RTC_ReadBackup(RTC_BAKP_DATA_T backup);
  439. /** Output Type Config configuration functions */
  440. void RTC_ConfigOutputType(RTC_OUTPUT_T output);
  441. /** RTC Shift control synchonisation functions */
  442. uint8_t RTC_ConfigSynchroShift(RTC_SHIFT_ADD1S_T add1S, uint32_t subFS);
  443. /** Interrupts and flags management functions */
  444. void RTC_EnableInterrupt(uint32_t interrupt);
  445. void RTC_DisableInterrupt(uint32_t interrupt);
  446. uint8_t RTC_ReadStatusFlag(RTC_FLAG_T flag);
  447. void RTC_ClearStatusFlag(uint32_t flag);
  448. uint8_t RTC_ReadIntFlag(RTC_INT_FLAG_T flag);
  449. void RTC_ClearIntFlag(uint32_t flag);
  450. #ifdef __cplusplus
  451. }
  452. #endif
  453. #endif /* __APM32F0XX_RTC_H */
  454. /**@} end of group RTC_Functions */
  455. /**@} end of group RTC_Driver */
  456. /**@} end of group APM32F0xx_StdPeriphDriver */