⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stm8l15x_rtc.h

📁 STM8L的tim4定时器使用
💻 H
字号:
/**
  ******************************************************************************
  * @file    stm8l15x_rtc.h
  * @author  MCD Application Team
  * @version V1.5.0
  * @date    13-May-2011
  * @brief   This file contains all the functions prototypes for the RTC 
  *          firmware library.
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  ******************************************************************************  
  */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM8L15x_RTC_H
#define __STM8L15x_RTC_H

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

/** @addtogroup STM8L15x_StdPeriph_Driver
  * @{
  */

/** @addtogroup RTC
  * @{
  */ 
  
/* Exported types ------------------------------------------------------------*/
/** @defgroup RTC_Exported_Types
  * @{
  */

/** @defgroup RTC_Weekdays
  * @{
  */ 
typedef enum
{
  RTC_Weekday_Monday      =  ((uint8_t)0x01), /*!< WeekDay is Monday */
  RTC_Weekday_Tuesday     =  ((uint8_t)0x02), /*!< WeekDay is Tuesday */
  RTC_Weekday_Wednesday   =  ((uint8_t)0x03), /*!< WeekDay is Wednesday */
  RTC_Weekday_Thursday    =  ((uint8_t)0x04), /*!< WeekDay is Thursday */
  RTC_Weekday_Friday      =  ((uint8_t)0x05), /*!< WeekDay is Friday */
  RTC_Weekday_Saturday    =  ((uint8_t)0x06), /*!< WeekDay is Saturday */
  RTC_Weekday_Sunday      =  ((uint8_t)0x07)  /*!< WeekDay is Sunday */
}
RTC_Weekday_TypeDef;

/**
  * @}
  */
  
/** @defgroup RTC_Months
  * @{
  */ 
typedef enum
{
  RTC_Month_January   =  ((uint8_t)0x01), /*!< Month is January */
  RTC_Month_February  =  ((uint8_t)0x02), /*!< Month is February */
  RTC_Month_March     =  ((uint8_t)0x03), /*!< Month is March */
  RTC_Month_April     =  ((uint8_t)0x04), /*!< Month is April */
  RTC_Month_May       =  ((uint8_t)0x05), /*!< Month is May */
  RTC_Month_June      =  ((uint8_t)0x06), /*!< Month is June */
  RTC_Month_July      =  ((uint8_t)0x07), /*!< Month is July */
  RTC_Month_August    =  ((uint8_t)0x08), /*!< Month is August */
  RTC_Month_September =  ((uint8_t)0x09), /*!< Month is September */
  RTC_Month_October   =  ((uint8_t)0x10), /*!< Month is October */
  RTC_Month_November  =  ((uint8_t)0x11), /*!< Month is November */
  RTC_Month_December  =  ((uint8_t)0x12)  /*!< Month is December */
}
RTC_Month_TypeDef;

/**
  * @}
  */
  
/** @defgroup RTC_Hour_Format
  * @{
  */ 
typedef enum
{
  RTC_HourFormat_24  = ((uint8_t)0x00), /*!< Hour Format is 24H */
  RTC_HourFormat_12  = ((uint8_t)0x40)  /*!< Hour Format is 12H (using AM/PM) */
}
RTC_HourFormat_TypeDef;

/**
  * @}
  */
  
/** @defgroup RTC_Time
  * @{
  */ 
typedef enum
{
  RTC_H12_AM     = ((uint8_t)0x00), /*!< AM/PM notation is AM or 24 hour format */
  RTC_H12_PM     = ((uint8_t)0x40)  /*!< AM/PM notation is PM  */
}
RTC_H12_TypeDef;

/**
  * @}
  */
  
/** @defgroup RTC_Alarm_WeekDay_Selection
  * @{
  */ 
typedef enum
{
  RTC_AlarmDateWeekDaySel_Date     = ((uint8_t)0x00), /*!< Date/WeekDay selection is Date */
  RTC_AlarmDateWeekDaySel_WeekDay  = ((uint8_t)0x40)  /*!< Date/WeekDay selection is WeekDay */
}
RTC_AlarmDateWeekDaySel_TypeDef;

/**
  * @}
  */
  
/** @defgroup RTC_Alarm_Mask
  * @{
  */ 
typedef enum
{
  RTC_AlarmMask_None         =  ((uint8_t)0x00), /*!< Alarm Masks disabled */
  RTC_AlarmMask_Seconds      =  ((uint8_t)0x80), /*!< Alarm Seconds Mask */
  RTC_AlarmMask_Minutes      =  ((uint8_t)0x40), /*!< Alarm Minutes Mask */
  RTC_AlarmMask_Hours        =  ((uint8_t)0x20), /*!< Alarm Hours Mask */
  RTC_AlarmMask_DateWeekDay  =  ((uint8_t)0x10), /*!< Alarm Date/WeekDay Mask */
  RTC_AlarmMask_All          =  ((uint8_t)0xF0)  /*!< Alarm All Mask are enabled */
}
RTC_AlarmMask_TypeDef;

/**
  * @}
  */
  
/** @defgroup RTC_Sub_Second_Alarm_Mask
  * @{
  */ 
typedef enum
{
  RTC_AlarmSubSecondMask_All      =  ((uint8_t)0x00), /*!< All Alarm SS fields are masked. There is no comparison on sub seconds for Alarm */
  RTC_AlarmSubSecondMask_None     =  ((uint8_t)0x0F), /*!< SS[14:0] are compared and must match to activate alarm. */
  RTC_AlarmSubSecondMask_SS14_1   =  ((uint8_t)0x01), /*!< SS[14:1] are not used in Alarm comparison. Only SS[0] is compared. */
  RTC_AlarmSubSecondMask_SS14_2   =  ((uint8_t)0x02), /*!< SS[14:2] are not used in Alarm comparison. Only SS[1:0] are compared */
  RTC_AlarmSubSecondMask_SS14_3   =  ((uint8_t)0x03), /*!< SS[14:3] are not used in Alarm comparison. Only SS[1:0] are compared */
  RTC_AlarmSubSecondMask_SS14_4   =  ((uint8_t)0x04), /*!< SS[14:4] are not used in Alarm comparison. Only SS[1:0] are compared */
  RTC_AlarmSubSecondMask_SS14_5   =  ((uint8_t)0x05), /*!< SS[14:5] are not used in Alarm comparison. Only SS[1:0] are compared */
  RTC_AlarmSubSecondMask_SS14_6   =  ((uint8_t)0x06), /*!< SS[14:6] are not used in Alarm comparison. Only SS[1:0] are compared */
  RTC_AlarmSubSecondMask_SS14_7   =  ((uint8_t)0x07), /*!< SS[14:7] are not used in Alarm comparison. Only SS[1:0] are compared */
  RTC_AlarmSubSecondMask_SS14_8   =  ((uint8_t)0x08), /*!< SS[14:8] are not used in Alarm comparison. Only SS[1:0] are compared */
  RTC_AlarmSubSecondMask_SS14_9   =  ((uint8_t)0x09), /*!< SS[14:9] are not used in Alarm comparison. Only SS[1:0] are compared */
  RTC_AlarmSubSecondMask_SS14_10  =  ((uint8_t)0x0A), /*!< SS[14:10] are not used in Alarm comparison. Only SS[1:0] are compared */
  RTC_AlarmSubSecondMask_SS14_11  =  ((uint8_t)0x0B), /*!< SS[14:11] are not used in Alarm comparison. Only SS[1:0] are compared */
  RTC_AlarmSubSecondMask_SS14_12  =  ((uint8_t)0x0C), /*!< SS[14:12] are not used in Alarm comparison. Only SS[1:0] are compared */
  RTC_AlarmSubSecondMask_SS14_13  =  ((uint8_t)0x0D), /*!< SS[14:13] are not used in Alarm comparison. Only SS[1:0] are compared */
  RTC_AlarmSubSecondMask_SS14     =  ((uint8_t)0x0E) /*!< SS[14] is not used in Alarm comparison. Only SS[13:0] are compared */
}
RTC_AlarmSubSecondMask_TypeDef;

/**
  * @}
  */
  
/** @defgroup RTC_Wakeup_Clock
  * @{
  */ 
typedef enum
{
  RTC_WakeUpClock_RTCCLK_Div16    = ((uint8_t)0x00), /*!< (RTC clock) div 16*/
  RTC_WakeUpClock_RTCCLK_Div8     = ((uint8_t)0x01), /*!< (RTC clock) div 8*/
  RTC_WakeUpClock_RTCCLK_Div4     = ((uint8_t)0x02), /*!< (RTC clock) div 4*/
  RTC_WakeUpClock_RTCCLK_Div2     = ((uint8_t)0x03), /*!< (RTC clock) div 2*/
  RTC_WakeUpClock_CK_SPRE_16bits  = ((uint8_t)0x04), /*!< CK SPRE with a counter from 0x0000 to 0xFFFF */
  RTC_WakeUpClock_CK_SPRE_17bits  = ((uint8_t)0x06)  /*!< CK SPRE with a counter from 0x10000 to 0x1FFFF */
}
RTC_WakeUpClock_TypeDef;

/**
  * @}
  */
  
/** @defgroup RTC_Output_Selection
  * @{
  */ 
typedef enum
{
  RTC_Output_Disable = ((uint8_t)0x00), /*!< RTC Alternate function Output is disabled  */
  RTC_Output_Alarm   = ((uint8_t)0x20), /*!< RTC Alternate function Output is the Alarm A event*/
  RTC_Output_WakeUp  = ((uint8_t)0x60)  /*!< RTC Alternate function Output is the WakeUp event */
}
RTC_Output_TypeDef;

/**
  * @}
  */
  
/** @defgroup RTC_Output_Polarity
  * @{
  */ 
typedef enum
{
  RTC_OutputPolarity_High  = ((uint8_t)0x00), /*!< RTC Alternate function Output Polarity is High  */
  RTC_OutputPolarity_Low   = ((uint8_t)0x10)  /*!< RTC Alternate function Output Polarity is Low  */
}
RTC_OutputPolarity_TypeDef;

/**
  * @}
  */
  
/** @defgroup RTC_Calibration_Output
  * @{
  */ 
typedef enum
{
  RTC_CalibOutput_512Hz  = ((uint8_t)0x00), /*!< RTC Calibration Output is 512Hz */
  RTC_CalibOutput_1Hz    = ((uint8_t)0x80)  /*!< RTC Calibration Output is 1Hz */
}
RTC_CalibOutput_TypeDef;

/**
  * @}
  */
  
/** @defgroup RTC_DayLight_Saving
  * @{
  */ 
typedef enum
{
  RTC_DayLightSaving_SUB1H  = ((uint8_t)0x02), /*!< Substract 1 hour to the current Time (Winter Time Adjustment) */
  RTC_DayLightSaving_ADD1H  = ((uint8_t)0x01)  /*!< Add 1 hour to the current Time (Summer Time Adjustment) */
}
RTC_DayLightSaving_TypeDef;

/**
  * @}
  */
  
/** @defgroup RTC_Store_Operation
  * @{
  */ 
typedef enum
{
  RTC_StoreOperation_Set   = ((uint8_t)0x04), /*!< Store Operation Set */
  RTC_StoreOperation_Reset = ((uint8_t)0x00)  /*!< Store Operation Reset */
}
RTC_StoreOperation_TypeDef;

/**
  * @}
  */
  
/** @defgroup RTC_Input_Parameter_Format
  * @{
  */ 
typedef enum
{
  RTC_Format_BIN  = ((uint8_t)0x00), /*!< Binary Format is used  */
  RTC_Format_BCD  = ((uint8_t)0x01)  /*!< BCD Format is used  */
}
RTC_Format_TypeDef;

/**
  * @}
  */
  
/** @defgroup RTC_Flags
  * @{
  */ 
typedef enum
{
  RTC_FLAG_TAMP3F  = ((uint16_t)0x0080), /*!< TAMPER3 detection  Flag. If set, tamper detection event is detected on tamper input 3 */
  RTC_FLAG_TAMP2F  = ((uint16_t)0x0040), /*!< TAMPER2 detection  Flag. If set, tamper detection event is detected on tamper input 2 */
  RTC_FLAG_TAMP1F  = ((uint16_t)0x0020), /*!< TAMPER1 detection  Flag. If set, tamper detection event is detected on tamper input 1 */

  RTC_FLAG_WUTF    = ((uint16_t)0x0004), /*!< Wake up Timer Flag. If set, the Wake Up down counter reaches 0 */
  RTC_FLAG_ALRAF   = ((uint16_t)0x0001), /*!< Alarm A Flag. If set, the Time/Date registers matches Alarm A registers */

  RTC_FLAG_INITF   = ((uint16_t)0x4000), /*!< Initialisation Flag. If set,Calender registers has been initialized  */
  RTC_FLAG_RSF     = ((uint16_t)0x2000), /*!< Registers Synchronization Flag. If set,Calender registers synchronized  */
  RTC_FLAG_INITS   = ((uint16_t)0x1000), /*!< Initialisation Status Flag. If set,Calender  update is allowed  */

  RTC_FLAG_SHPF    = ((uint16_t)0x0800), /*!< Shift operation pending Flag. This flag is set by hardware as soon as a shift operation is
                                              initiated by a write to the RTC_SHIFTRL. It is cleared by hardware as soon as the corresponding
                                              shift operation has completed.  */

  RTC_FLAG_WUTWF   = ((uint16_t)0x0400), /*!< Wake up Timer write Flag. If set, Wake up Timer update is allowed */
  RTC_FLAG_RECALPF = ((uint16_t)0x0200), /*!<   Recalibration pending Flag, The status flag RECALPF is automatically set to 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -