gd32f10x_rtc.h 2.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
/**
  ******************************************************************************
  * @brief   RTC header file of the firmware library.
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __GD32F10X_RTC_H
#define __GD32F10X_RTC_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "gd32f10x.h"

/** @addtogroup GD32F10x_Firmware
  * @{
  */

/** @addtogroup RTC
  * @{
  */

/** @defgroup RTC_Exported_Defines
  * @{
  */

/** @defgroup RTC_Interrupt_Def
  * @{
  */
#define RTC_INT_OVF                        ((uint16_t)0x0004)  /*!< Overflow interrupt */
#define RTC_INT_AF                         ((uint16_t)0x0002)  /*!< Alarm interrupt */
#define RTC_INT_SF                         ((uint16_t)0x0001)  /*!< Second interrupt */

/**
  * @}
  */

/** @defgroup RTC_Interrupts_Flags
  * @{
  */
#define RTC_FLAG_LWOFF                     ((uint16_t)0x0020)  /*!< Last write operation finished flag */
#define RTC_FLAG_RSF                       ((uint16_t)0x0008)  /*!< Registers Synchronized flag */
#define RTC_FLAG_OVF                       ((uint16_t)0x0004)  /*!< Overflow flag */
#define RTC_FLAG_AF                        ((uint16_t)0x0002)  /*!< Alarm flag */
#define RTC_FLAG_SF                        ((uint16_t)0x0001)  /*!< Second flag */

/**
  * @}
  */

/**
  * @}
  */

/** @defgroup RTC_Exported_Functions
  * @{
  */
void RTC_INT_Enable(uint16_t RTC_int, TypeState NewValue);
void RTC_EnterConfigMode(void);
void RTC_ExitConfigMode(void);
uint32_t  RTC_GetCounter(void);
void RTC_SetCounter(uint32_t CounterValue);
void RTC_SetPrescaler(uint32_t PrescalerValue);
void RTC_SetAlarm(uint32_t AlarmTime);
uint32_t  RTC_GetDividerValue(void);
void RTC_WaitLWOFF(void);
void RTC_WaitRSF(void);
TypeState RTC_GetBitState(uint16_t RTC_flag);
void RTC_ClearBitState(uint16_t RTC_flag);
TypeState RTC_GetIntBitState(uint16_t RTC_INT);
void RTC_ClearIntBitState(uint16_t RTC_INT);

/**
  * @}
  */

#ifdef __cplusplus
}
#endif

#endif /*__GD32F10X_RTC_H */

/**
  * @}
  */

/**
  * @}
  */