ch32v30x_rtc.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /********************************** (C) COPYRIGHT *******************************
  2. * File Name : ch32v30x_rtc.h
  3. * Author : WCH
  4. * Version : V1.0.0
  5. * Date : 2021/06/06
  6. * Description : This file contains all the functions prototypes for the RTC
  7. * firmware library.
  8. *********************************************************************************
  9. * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
  10. * Attention: This software (modified or not) and binary are used for
  11. * microcontroller manufactured by Nanjing Qinheng Microelectronics.
  12. *******************************************************************************/
  13. #ifndef __CH32V30x_RTC_H
  14. #define __CH32V30x_RTC_H
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include "ch32v30x.h"
  19. /* RTC_interrupts_define */
  20. #define RTC_IT_OW ((uint16_t)0x0004) /* Overflow interrupt */
  21. #define RTC_IT_ALR ((uint16_t)0x0002) /* Alarm interrupt */
  22. #define RTC_IT_SEC ((uint16_t)0x0001) /* Second interrupt */
  23. /* RTC_interrupts_flags */
  24. #define RTC_FLAG_RTOFF ((uint16_t)0x0020) /* RTC Operation OFF flag */
  25. #define RTC_FLAG_RSF ((uint16_t)0x0008) /* Registers Synchronized flag */
  26. #define RTC_FLAG_OW ((uint16_t)0x0004) /* Overflow flag */
  27. #define RTC_FLAG_ALR ((uint16_t)0x0002) /* Alarm flag */
  28. #define RTC_FLAG_SEC ((uint16_t)0x0001) /* Second flag */
  29. void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState);
  30. void RTC_EnterConfigMode(void);
  31. void RTC_ExitConfigMode(void);
  32. uint32_t RTC_GetCounter(void);
  33. void RTC_SetCounter(uint32_t CounterValue);
  34. void RTC_SetPrescaler(uint32_t PrescalerValue);
  35. void RTC_SetAlarm(uint32_t AlarmValue);
  36. uint32_t RTC_GetDivider(void);
  37. void RTC_WaitForLastTask(void);
  38. void RTC_WaitForSynchro(void);
  39. FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG);
  40. void RTC_ClearFlag(uint16_t RTC_FLAG);
  41. ITStatus RTC_GetITStatus(uint16_t RTC_IT);
  42. void RTC_ClearITPendingBit(uint16_t RTC_IT);
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46. #endif