Martin Johnson / STM32F3-Discovery

Dependents:   Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more

Committer:
MartinJohnson
Date:
Mon May 09 04:00:25 2016 +0000
Revision:
0:404f5a4f1385
Initial library for STM32F3 discovery board

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MartinJohnson 0:404f5a4f1385 1 /**
MartinJohnson 0:404f5a4f1385 2 ******************************************************************************
MartinJohnson 0:404f5a4f1385 3 * @file stm32f30x_rtc.h
MartinJohnson 0:404f5a4f1385 4 * @author MCD Application Team
MartinJohnson 0:404f5a4f1385 5 * @version V1.2.3
MartinJohnson 0:404f5a4f1385 6 * @date 10-July-2015
MartinJohnson 0:404f5a4f1385 7 * @brief This file contains all the functions prototypes for the RTC firmware
MartinJohnson 0:404f5a4f1385 8 * library.
MartinJohnson 0:404f5a4f1385 9 ******************************************************************************
MartinJohnson 0:404f5a4f1385 10 * @attention
MartinJohnson 0:404f5a4f1385 11 *
MartinJohnson 0:404f5a4f1385 12 * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
MartinJohnson 0:404f5a4f1385 13 *
MartinJohnson 0:404f5a4f1385 14 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
MartinJohnson 0:404f5a4f1385 15 * You may not use this file except in compliance with the License.
MartinJohnson 0:404f5a4f1385 16 * You may obtain a copy of the License at:
MartinJohnson 0:404f5a4f1385 17 *
MartinJohnson 0:404f5a4f1385 18 * http://www.st.com/software_license_agreement_liberty_v2
MartinJohnson 0:404f5a4f1385 19 *
MartinJohnson 0:404f5a4f1385 20 * Unless required by applicable law or agreed to in writing, software
MartinJohnson 0:404f5a4f1385 21 * distributed under the License is distributed on an "AS IS" BASIS,
MartinJohnson 0:404f5a4f1385 22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MartinJohnson 0:404f5a4f1385 23 * See the License for the specific language governing permissions and
MartinJohnson 0:404f5a4f1385 24 * limitations under the License.
MartinJohnson 0:404f5a4f1385 25 *
MartinJohnson 0:404f5a4f1385 26 ******************************************************************************
MartinJohnson 0:404f5a4f1385 27 */
MartinJohnson 0:404f5a4f1385 28
MartinJohnson 0:404f5a4f1385 29 /* Define to prevent recursive inclusion -------------------------------------*/
MartinJohnson 0:404f5a4f1385 30 #ifndef __STM32F30x_RTC_H
MartinJohnson 0:404f5a4f1385 31 #define __STM32F30x_RTC_H
MartinJohnson 0:404f5a4f1385 32
MartinJohnson 0:404f5a4f1385 33 #ifdef __cplusplus
MartinJohnson 0:404f5a4f1385 34 extern "C" {
MartinJohnson 0:404f5a4f1385 35 #endif
MartinJohnson 0:404f5a4f1385 36
MartinJohnson 0:404f5a4f1385 37 /* Includes ------------------------------------------------------------------*/
MartinJohnson 0:404f5a4f1385 38 #include "stm32f30x.h"
MartinJohnson 0:404f5a4f1385 39
MartinJohnson 0:404f5a4f1385 40 /** @addtogroup STM32F30x_StdPeriph_Driver
MartinJohnson 0:404f5a4f1385 41 * @{
MartinJohnson 0:404f5a4f1385 42 */
MartinJohnson 0:404f5a4f1385 43
MartinJohnson 0:404f5a4f1385 44 /** @addtogroup RTC
MartinJohnson 0:404f5a4f1385 45 * @{
MartinJohnson 0:404f5a4f1385 46 */
MartinJohnson 0:404f5a4f1385 47
MartinJohnson 0:404f5a4f1385 48 /* Exported types ------------------------------------------------------------*/
MartinJohnson 0:404f5a4f1385 49
MartinJohnson 0:404f5a4f1385 50 /**
MartinJohnson 0:404f5a4f1385 51 * @brief RTC Init structures definition
MartinJohnson 0:404f5a4f1385 52 */
MartinJohnson 0:404f5a4f1385 53 typedef struct
MartinJohnson 0:404f5a4f1385 54 {
MartinJohnson 0:404f5a4f1385 55 uint32_t RTC_HourFormat; /*!< Specifies the RTC Hour Format.
MartinJohnson 0:404f5a4f1385 56 This parameter can be a value of @ref RTC_Hour_Formats */
MartinJohnson 0:404f5a4f1385 57
MartinJohnson 0:404f5a4f1385 58 uint32_t RTC_AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value.
MartinJohnson 0:404f5a4f1385 59 This parameter must be set to a value lower than 0x7F */
MartinJohnson 0:404f5a4f1385 60
MartinJohnson 0:404f5a4f1385 61 uint32_t RTC_SynchPrediv; /*!< Specifies the RTC Synchronous Predivider value.
MartinJohnson 0:404f5a4f1385 62 This parameter must be set to a value lower than 0x1FFF */
MartinJohnson 0:404f5a4f1385 63 }RTC_InitTypeDef;
MartinJohnson 0:404f5a4f1385 64
MartinJohnson 0:404f5a4f1385 65 /**
MartinJohnson 0:404f5a4f1385 66 * @brief RTC Time structure definition
MartinJohnson 0:404f5a4f1385 67 */
MartinJohnson 0:404f5a4f1385 68 typedef struct
MartinJohnson 0:404f5a4f1385 69 {
MartinJohnson 0:404f5a4f1385 70 uint8_t RTC_Hours; /*!< Specifies the RTC Time Hour.
MartinJohnson 0:404f5a4f1385 71 This parameter must be set to a value in the 0-12 range
MartinJohnson 0:404f5a4f1385 72 if the RTC_HourFormat_12 is selected or 0-23 range if
MartinJohnson 0:404f5a4f1385 73 the RTC_HourFormat_24 is selected. */
MartinJohnson 0:404f5a4f1385 74
MartinJohnson 0:404f5a4f1385 75 uint8_t RTC_Minutes; /*!< Specifies the RTC Time Minutes.
MartinJohnson 0:404f5a4f1385 76 This parameter must be set to a value in the 0-59 range. */
MartinJohnson 0:404f5a4f1385 77
MartinJohnson 0:404f5a4f1385 78 uint8_t RTC_Seconds; /*!< Specifies the RTC Time Seconds.
MartinJohnson 0:404f5a4f1385 79 This parameter must be set to a value in the 0-59 range. */
MartinJohnson 0:404f5a4f1385 80
MartinJohnson 0:404f5a4f1385 81 uint8_t RTC_H12; /*!< Specifies the RTC AM/PM Time.
MartinJohnson 0:404f5a4f1385 82 This parameter can be a value of @ref RTC_AM_PM_Definitions */
MartinJohnson 0:404f5a4f1385 83 }RTC_TimeTypeDef;
MartinJohnson 0:404f5a4f1385 84
MartinJohnson 0:404f5a4f1385 85 /**
MartinJohnson 0:404f5a4f1385 86 * @brief RTC Date structure definition
MartinJohnson 0:404f5a4f1385 87 */
MartinJohnson 0:404f5a4f1385 88 typedef struct
MartinJohnson 0:404f5a4f1385 89 {
MartinJohnson 0:404f5a4f1385 90 uint8_t RTC_WeekDay; /*!< Specifies the RTC Date WeekDay.
MartinJohnson 0:404f5a4f1385 91 This parameter can be a value of @ref RTC_WeekDay_Definitions */
MartinJohnson 0:404f5a4f1385 92
MartinJohnson 0:404f5a4f1385 93 uint8_t RTC_Month; /*!< Specifies the RTC Date Month (in BCD format).
MartinJohnson 0:404f5a4f1385 94 This parameter can be a value of @ref RTC_Month_Date_Definitions */
MartinJohnson 0:404f5a4f1385 95
MartinJohnson 0:404f5a4f1385 96 uint8_t RTC_Date; /*!< Specifies the RTC Date.
MartinJohnson 0:404f5a4f1385 97 This parameter must be set to a value in the 1-31 range. */
MartinJohnson 0:404f5a4f1385 98
MartinJohnson 0:404f5a4f1385 99 uint8_t RTC_Year; /*!< Specifies the RTC Date Year.
MartinJohnson 0:404f5a4f1385 100 This parameter must be set to a value in the 0-99 range. */
MartinJohnson 0:404f5a4f1385 101 }RTC_DateTypeDef;
MartinJohnson 0:404f5a4f1385 102
MartinJohnson 0:404f5a4f1385 103 /**
MartinJohnson 0:404f5a4f1385 104 * @brief RTC Alarm structure definition
MartinJohnson 0:404f5a4f1385 105 */
MartinJohnson 0:404f5a4f1385 106 typedef struct
MartinJohnson 0:404f5a4f1385 107 {
MartinJohnson 0:404f5a4f1385 108 RTC_TimeTypeDef RTC_AlarmTime; /*!< Specifies the RTC Alarm Time members. */
MartinJohnson 0:404f5a4f1385 109
MartinJohnson 0:404f5a4f1385 110 uint32_t RTC_AlarmMask; /*!< Specifies the RTC Alarm Masks.
MartinJohnson 0:404f5a4f1385 111 This parameter can be a value of @ref RTC_AlarmMask_Definitions */
MartinJohnson 0:404f5a4f1385 112
MartinJohnson 0:404f5a4f1385 113 uint32_t RTC_AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on Date or WeekDay.
MartinJohnson 0:404f5a4f1385 114 This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */
MartinJohnson 0:404f5a4f1385 115
MartinJohnson 0:404f5a4f1385 116 uint8_t RTC_AlarmDateWeekDay; /*!< Specifies the RTC Alarm Date/WeekDay.
MartinJohnson 0:404f5a4f1385 117 If the Alarm Date is selected, this parameter
MartinJohnson 0:404f5a4f1385 118 must be set to a value in the 1-31 range.
MartinJohnson 0:404f5a4f1385 119 If the Alarm WeekDay is selected, this
MartinJohnson 0:404f5a4f1385 120 parameter can be a value of @ref RTC_WeekDay_Definitions */
MartinJohnson 0:404f5a4f1385 121 }RTC_AlarmTypeDef;
MartinJohnson 0:404f5a4f1385 122
MartinJohnson 0:404f5a4f1385 123 /* Exported constants --------------------------------------------------------*/
MartinJohnson 0:404f5a4f1385 124
MartinJohnson 0:404f5a4f1385 125 /** @defgroup RTC_Exported_Constants
MartinJohnson 0:404f5a4f1385 126 * @{
MartinJohnson 0:404f5a4f1385 127 */
MartinJohnson 0:404f5a4f1385 128
MartinJohnson 0:404f5a4f1385 129
MartinJohnson 0:404f5a4f1385 130 /** @defgroup RTC_Hour_Formats
MartinJohnson 0:404f5a4f1385 131 * @{
MartinJohnson 0:404f5a4f1385 132 */
MartinJohnson 0:404f5a4f1385 133 #define RTC_HourFormat_24 ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 134 #define RTC_HourFormat_12 ((uint32_t)0x00000040)
MartinJohnson 0:404f5a4f1385 135 #define IS_RTC_HOUR_FORMAT(FORMAT) (((FORMAT) == RTC_HourFormat_12) || \
MartinJohnson 0:404f5a4f1385 136 ((FORMAT) == RTC_HourFormat_24))
MartinJohnson 0:404f5a4f1385 137 /**
MartinJohnson 0:404f5a4f1385 138 * @}
MartinJohnson 0:404f5a4f1385 139 */
MartinJohnson 0:404f5a4f1385 140
MartinJohnson 0:404f5a4f1385 141 /** @defgroup RTC_Asynchronous_Predivider
MartinJohnson 0:404f5a4f1385 142 * @{
MartinJohnson 0:404f5a4f1385 143 */
MartinJohnson 0:404f5a4f1385 144 #define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7F)
MartinJohnson 0:404f5a4f1385 145
MartinJohnson 0:404f5a4f1385 146 /**
MartinJohnson 0:404f5a4f1385 147 * @}
MartinJohnson 0:404f5a4f1385 148 */
MartinJohnson 0:404f5a4f1385 149
MartinJohnson 0:404f5a4f1385 150
MartinJohnson 0:404f5a4f1385 151 /** @defgroup RTC_Synchronous_Predivider
MartinJohnson 0:404f5a4f1385 152 * @{
MartinJohnson 0:404f5a4f1385 153 */
MartinJohnson 0:404f5a4f1385 154 #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7FFF)
MartinJohnson 0:404f5a4f1385 155
MartinJohnson 0:404f5a4f1385 156 /**
MartinJohnson 0:404f5a4f1385 157 * @}
MartinJohnson 0:404f5a4f1385 158 */
MartinJohnson 0:404f5a4f1385 159
MartinJohnson 0:404f5a4f1385 160 /** @defgroup RTC_Time_Definitions
MartinJohnson 0:404f5a4f1385 161 * @{
MartinJohnson 0:404f5a4f1385 162 */
MartinJohnson 0:404f5a4f1385 163 #define IS_RTC_HOUR12(HOUR) (((HOUR) > 0) && ((HOUR) <= 12))
MartinJohnson 0:404f5a4f1385 164 #define IS_RTC_HOUR24(HOUR) ((HOUR) <= 23)
MartinJohnson 0:404f5a4f1385 165 #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= 59)
MartinJohnson 0:404f5a4f1385 166 #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= 59)
MartinJohnson 0:404f5a4f1385 167
MartinJohnson 0:404f5a4f1385 168 /**
MartinJohnson 0:404f5a4f1385 169 * @}
MartinJohnson 0:404f5a4f1385 170 */
MartinJohnson 0:404f5a4f1385 171
MartinJohnson 0:404f5a4f1385 172 /** @defgroup RTC_AM_PM_Definitions
MartinJohnson 0:404f5a4f1385 173 * @{
MartinJohnson 0:404f5a4f1385 174 */
MartinJohnson 0:404f5a4f1385 175 #define RTC_H12_AM ((uint8_t)0x00)
MartinJohnson 0:404f5a4f1385 176 #define RTC_H12_PM ((uint8_t)0x40)
MartinJohnson 0:404f5a4f1385 177 #define IS_RTC_H12(PM) (((PM) == RTC_H12_AM) || ((PM) == RTC_H12_PM))
MartinJohnson 0:404f5a4f1385 178
MartinJohnson 0:404f5a4f1385 179 /**
MartinJohnson 0:404f5a4f1385 180 * @}
MartinJohnson 0:404f5a4f1385 181 */
MartinJohnson 0:404f5a4f1385 182
MartinJohnson 0:404f5a4f1385 183 /** @defgroup RTC_Year_Date_Definitions
MartinJohnson 0:404f5a4f1385 184 * @{
MartinJohnson 0:404f5a4f1385 185 */
MartinJohnson 0:404f5a4f1385 186 #define IS_RTC_YEAR(YEAR) ((YEAR) <= 99)
MartinJohnson 0:404f5a4f1385 187
MartinJohnson 0:404f5a4f1385 188 /**
MartinJohnson 0:404f5a4f1385 189 * @}
MartinJohnson 0:404f5a4f1385 190 */
MartinJohnson 0:404f5a4f1385 191
MartinJohnson 0:404f5a4f1385 192 /** @defgroup RTC_Month_Date_Definitions
MartinJohnson 0:404f5a4f1385 193 * @{
MartinJohnson 0:404f5a4f1385 194 */
MartinJohnson 0:404f5a4f1385 195
MartinJohnson 0:404f5a4f1385 196 /* Coded in BCD format */
MartinJohnson 0:404f5a4f1385 197 #define RTC_Month_January ((uint8_t)0x01)
MartinJohnson 0:404f5a4f1385 198 #define RTC_Month_February ((uint8_t)0x02)
MartinJohnson 0:404f5a4f1385 199 #define RTC_Month_March ((uint8_t)0x03)
MartinJohnson 0:404f5a4f1385 200 #define RTC_Month_April ((uint8_t)0x04)
MartinJohnson 0:404f5a4f1385 201 #define RTC_Month_May ((uint8_t)0x05)
MartinJohnson 0:404f5a4f1385 202 #define RTC_Month_June ((uint8_t)0x06)
MartinJohnson 0:404f5a4f1385 203 #define RTC_Month_July ((uint8_t)0x07)
MartinJohnson 0:404f5a4f1385 204 #define RTC_Month_August ((uint8_t)0x08)
MartinJohnson 0:404f5a4f1385 205 #define RTC_Month_September ((uint8_t)0x09)
MartinJohnson 0:404f5a4f1385 206 #define RTC_Month_October ((uint8_t)0x10)
MartinJohnson 0:404f5a4f1385 207 #define RTC_Month_November ((uint8_t)0x11)
MartinJohnson 0:404f5a4f1385 208 #define RTC_Month_December ((uint8_t)0x12)
MartinJohnson 0:404f5a4f1385 209 #define IS_RTC_MONTH(MONTH) (((MONTH) >= 1) && ((MONTH) <= 12))
MartinJohnson 0:404f5a4f1385 210 #define IS_RTC_DATE(DATE) (((DATE) >= 1) && ((DATE) <= 31))
MartinJohnson 0:404f5a4f1385 211
MartinJohnson 0:404f5a4f1385 212 /**
MartinJohnson 0:404f5a4f1385 213 * @}
MartinJohnson 0:404f5a4f1385 214 */
MartinJohnson 0:404f5a4f1385 215
MartinJohnson 0:404f5a4f1385 216 /** @defgroup RTC_WeekDay_Definitions
MartinJohnson 0:404f5a4f1385 217 * @{
MartinJohnson 0:404f5a4f1385 218 */
MartinJohnson 0:404f5a4f1385 219
MartinJohnson 0:404f5a4f1385 220 #define RTC_Weekday_Monday ((uint8_t)0x01)
MartinJohnson 0:404f5a4f1385 221 #define RTC_Weekday_Tuesday ((uint8_t)0x02)
MartinJohnson 0:404f5a4f1385 222 #define RTC_Weekday_Wednesday ((uint8_t)0x03)
MartinJohnson 0:404f5a4f1385 223 #define RTC_Weekday_Thursday ((uint8_t)0x04)
MartinJohnson 0:404f5a4f1385 224 #define RTC_Weekday_Friday ((uint8_t)0x05)
MartinJohnson 0:404f5a4f1385 225 #define RTC_Weekday_Saturday ((uint8_t)0x06)
MartinJohnson 0:404f5a4f1385 226 #define RTC_Weekday_Sunday ((uint8_t)0x07)
MartinJohnson 0:404f5a4f1385 227 #define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_Weekday_Monday) || \
MartinJohnson 0:404f5a4f1385 228 ((WEEKDAY) == RTC_Weekday_Tuesday) || \
MartinJohnson 0:404f5a4f1385 229 ((WEEKDAY) == RTC_Weekday_Wednesday) || \
MartinJohnson 0:404f5a4f1385 230 ((WEEKDAY) == RTC_Weekday_Thursday) || \
MartinJohnson 0:404f5a4f1385 231 ((WEEKDAY) == RTC_Weekday_Friday) || \
MartinJohnson 0:404f5a4f1385 232 ((WEEKDAY) == RTC_Weekday_Saturday) || \
MartinJohnson 0:404f5a4f1385 233 ((WEEKDAY) == RTC_Weekday_Sunday))
MartinJohnson 0:404f5a4f1385 234 /**
MartinJohnson 0:404f5a4f1385 235 * @}
MartinJohnson 0:404f5a4f1385 236 */
MartinJohnson 0:404f5a4f1385 237
MartinJohnson 0:404f5a4f1385 238
MartinJohnson 0:404f5a4f1385 239 /** @defgroup RTC_Alarm_Definitions
MartinJohnson 0:404f5a4f1385 240 * @{
MartinJohnson 0:404f5a4f1385 241 */
MartinJohnson 0:404f5a4f1385 242 #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) > 0) && ((DATE) <= 31))
MartinJohnson 0:404f5a4f1385 243 #define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_Weekday_Monday) || \
MartinJohnson 0:404f5a4f1385 244 ((WEEKDAY) == RTC_Weekday_Tuesday) || \
MartinJohnson 0:404f5a4f1385 245 ((WEEKDAY) == RTC_Weekday_Wednesday) || \
MartinJohnson 0:404f5a4f1385 246 ((WEEKDAY) == RTC_Weekday_Thursday) || \
MartinJohnson 0:404f5a4f1385 247 ((WEEKDAY) == RTC_Weekday_Friday) || \
MartinJohnson 0:404f5a4f1385 248 ((WEEKDAY) == RTC_Weekday_Saturday) || \
MartinJohnson 0:404f5a4f1385 249 ((WEEKDAY) == RTC_Weekday_Sunday))
MartinJohnson 0:404f5a4f1385 250
MartinJohnson 0:404f5a4f1385 251 /**
MartinJohnson 0:404f5a4f1385 252 * @}
MartinJohnson 0:404f5a4f1385 253 */
MartinJohnson 0:404f5a4f1385 254
MartinJohnson 0:404f5a4f1385 255
MartinJohnson 0:404f5a4f1385 256 /** @defgroup RTC_AlarmDateWeekDay_Definitions
MartinJohnson 0:404f5a4f1385 257 * @{
MartinJohnson 0:404f5a4f1385 258 */
MartinJohnson 0:404f5a4f1385 259 #define RTC_AlarmDateWeekDaySel_Date ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 260 #define RTC_AlarmDateWeekDaySel_WeekDay ((uint32_t)0x40000000)
MartinJohnson 0:404f5a4f1385 261
MartinJohnson 0:404f5a4f1385 262 #define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL) (((SEL) == RTC_AlarmDateWeekDaySel_Date) || \
MartinJohnson 0:404f5a4f1385 263 ((SEL) == RTC_AlarmDateWeekDaySel_WeekDay))
MartinJohnson 0:404f5a4f1385 264
MartinJohnson 0:404f5a4f1385 265 /**
MartinJohnson 0:404f5a4f1385 266 * @}
MartinJohnson 0:404f5a4f1385 267 */
MartinJohnson 0:404f5a4f1385 268
MartinJohnson 0:404f5a4f1385 269
MartinJohnson 0:404f5a4f1385 270 /** @defgroup RTC_AlarmMask_Definitions
MartinJohnson 0:404f5a4f1385 271 * @{
MartinJohnson 0:404f5a4f1385 272 */
MartinJohnson 0:404f5a4f1385 273 #define RTC_AlarmMask_None ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 274 #define RTC_AlarmMask_DateWeekDay ((uint32_t)0x80000000)
MartinJohnson 0:404f5a4f1385 275 #define RTC_AlarmMask_Hours ((uint32_t)0x00800000)
MartinJohnson 0:404f5a4f1385 276 #define RTC_AlarmMask_Minutes ((uint32_t)0x00008000)
MartinJohnson 0:404f5a4f1385 277 #define RTC_AlarmMask_Seconds ((uint32_t)0x00000080)
MartinJohnson 0:404f5a4f1385 278 #define RTC_AlarmMask_All ((uint32_t)0x80808080)
MartinJohnson 0:404f5a4f1385 279 #define IS_ALARM_MASK(MASK) (((MASK) & 0x7F7F7F7F) == (uint32_t)RESET)
MartinJohnson 0:404f5a4f1385 280
MartinJohnson 0:404f5a4f1385 281 /**
MartinJohnson 0:404f5a4f1385 282 * @}
MartinJohnson 0:404f5a4f1385 283 */
MartinJohnson 0:404f5a4f1385 284
MartinJohnson 0:404f5a4f1385 285 /** @defgroup RTC_Alarms_Definitions
MartinJohnson 0:404f5a4f1385 286 * @{
MartinJohnson 0:404f5a4f1385 287 */
MartinJohnson 0:404f5a4f1385 288 #define RTC_Alarm_A ((uint32_t)0x00000100)
MartinJohnson 0:404f5a4f1385 289 #define RTC_Alarm_B ((uint32_t)0x00000200)
MartinJohnson 0:404f5a4f1385 290 #define IS_RTC_ALARM(ALARM) (((ALARM) == RTC_Alarm_A) || ((ALARM) == RTC_Alarm_B))
MartinJohnson 0:404f5a4f1385 291 #define IS_RTC_CMD_ALARM(ALARM) (((ALARM) & (RTC_Alarm_A | RTC_Alarm_B)) != (uint32_t)RESET)
MartinJohnson 0:404f5a4f1385 292
MartinJohnson 0:404f5a4f1385 293 /**
MartinJohnson 0:404f5a4f1385 294 * @}
MartinJohnson 0:404f5a4f1385 295 */
MartinJohnson 0:404f5a4f1385 296
MartinJohnson 0:404f5a4f1385 297 /** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions
MartinJohnson 0:404f5a4f1385 298 * @{
MartinJohnson 0:404f5a4f1385 299 */
MartinJohnson 0:404f5a4f1385 300 #define RTC_AlarmSubSecondMask_All ((uint32_t)0x00000000) /*!< All Alarm SS fields are masked.
MartinJohnson 0:404f5a4f1385 301 There is no comparison on sub seconds
MartinJohnson 0:404f5a4f1385 302 for Alarm */
MartinJohnson 0:404f5a4f1385 303 #define RTC_AlarmSubSecondMask_SS14_1 ((uint32_t)0x01000000) /*!< SS[14:1] are don't care in Alarm
MartinJohnson 0:404f5a4f1385 304 comparison. Only SS[0] is compared. */
MartinJohnson 0:404f5a4f1385 305 #define RTC_AlarmSubSecondMask_SS14_2 ((uint32_t)0x02000000) /*!< SS[14:2] are don't care in Alarm
MartinJohnson 0:404f5a4f1385 306 comparison. Only SS[1:0] are compared */
MartinJohnson 0:404f5a4f1385 307 #define RTC_AlarmSubSecondMask_SS14_3 ((uint32_t)0x03000000) /*!< SS[14:3] are don't care in Alarm
MartinJohnson 0:404f5a4f1385 308 comparison. Only SS[2:0] are compared */
MartinJohnson 0:404f5a4f1385 309 #define RTC_AlarmSubSecondMask_SS14_4 ((uint32_t)0x04000000) /*!< SS[14:4] are don't care in Alarm
MartinJohnson 0:404f5a4f1385 310 comparison. Only SS[3:0] are compared */
MartinJohnson 0:404f5a4f1385 311 #define RTC_AlarmSubSecondMask_SS14_5 ((uint32_t)0x05000000) /*!< SS[14:5] are don't care in Alarm
MartinJohnson 0:404f5a4f1385 312 comparison. Only SS[4:0] are compared */
MartinJohnson 0:404f5a4f1385 313 #define RTC_AlarmSubSecondMask_SS14_6 ((uint32_t)0x06000000) /*!< SS[14:6] are don't care in Alarm
MartinJohnson 0:404f5a4f1385 314 comparison. Only SS[5:0] are compared */
MartinJohnson 0:404f5a4f1385 315 #define RTC_AlarmSubSecondMask_SS14_7 ((uint32_t)0x07000000) /*!< SS[14:7] are don't care in Alarm
MartinJohnson 0:404f5a4f1385 316 comparison. Only SS[6:0] are compared */
MartinJohnson 0:404f5a4f1385 317 #define RTC_AlarmSubSecondMask_SS14_8 ((uint32_t)0x08000000) /*!< SS[14:8] are don't care in Alarm
MartinJohnson 0:404f5a4f1385 318 comparison. Only SS[7:0] are compared */
MartinJohnson 0:404f5a4f1385 319 #define RTC_AlarmSubSecondMask_SS14_9 ((uint32_t)0x09000000) /*!< SS[14:9] are don't care in Alarm
MartinJohnson 0:404f5a4f1385 320 comparison. Only SS[8:0] are compared */
MartinJohnson 0:404f5a4f1385 321 #define RTC_AlarmSubSecondMask_SS14_10 ((uint32_t)0x0A000000) /*!< SS[14:10] are don't care in Alarm
MartinJohnson 0:404f5a4f1385 322 comparison. Only SS[9:0] are compared */
MartinJohnson 0:404f5a4f1385 323 #define RTC_AlarmSubSecondMask_SS14_11 ((uint32_t)0x0B000000) /*!< SS[14:11] are don't care in Alarm
MartinJohnson 0:404f5a4f1385 324 comparison. Only SS[10:0] are compared */
MartinJohnson 0:404f5a4f1385 325 #define RTC_AlarmSubSecondMask_SS14_12 ((uint32_t)0x0C000000) /*!< SS[14:12] are don't care in Alarm
MartinJohnson 0:404f5a4f1385 326 comparison.Only SS[11:0] are compared */
MartinJohnson 0:404f5a4f1385 327 #define RTC_AlarmSubSecondMask_SS14_13 ((uint32_t)0x0D000000) /*!< SS[14:13] are don't care in Alarm
MartinJohnson 0:404f5a4f1385 328 comparison. Only SS[12:0] are compared */
MartinJohnson 0:404f5a4f1385 329 #define RTC_AlarmSubSecondMask_SS14 ((uint32_t)0x0E000000) /*!< SS[14] is don't care in Alarm
MartinJohnson 0:404f5a4f1385 330 comparison.Only SS[13:0] are compared */
MartinJohnson 0:404f5a4f1385 331 #define RTC_AlarmSubSecondMask_None ((uint32_t)0x0F000000) /*!< SS[14:0] are compared and must match
MartinJohnson 0:404f5a4f1385 332 to activate alarm. */
MartinJohnson 0:404f5a4f1385 333 #define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_AlarmSubSecondMask_All) || \
MartinJohnson 0:404f5a4f1385 334 ((MASK) == RTC_AlarmSubSecondMask_SS14_1) || \
MartinJohnson 0:404f5a4f1385 335 ((MASK) == RTC_AlarmSubSecondMask_SS14_2) || \
MartinJohnson 0:404f5a4f1385 336 ((MASK) == RTC_AlarmSubSecondMask_SS14_3) || \
MartinJohnson 0:404f5a4f1385 337 ((MASK) == RTC_AlarmSubSecondMask_SS14_4) || \
MartinJohnson 0:404f5a4f1385 338 ((MASK) == RTC_AlarmSubSecondMask_SS14_5) || \
MartinJohnson 0:404f5a4f1385 339 ((MASK) == RTC_AlarmSubSecondMask_SS14_6) || \
MartinJohnson 0:404f5a4f1385 340 ((MASK) == RTC_AlarmSubSecondMask_SS14_7) || \
MartinJohnson 0:404f5a4f1385 341 ((MASK) == RTC_AlarmSubSecondMask_SS14_8) || \
MartinJohnson 0:404f5a4f1385 342 ((MASK) == RTC_AlarmSubSecondMask_SS14_9) || \
MartinJohnson 0:404f5a4f1385 343 ((MASK) == RTC_AlarmSubSecondMask_SS14_10) || \
MartinJohnson 0:404f5a4f1385 344 ((MASK) == RTC_AlarmSubSecondMask_SS14_11) || \
MartinJohnson 0:404f5a4f1385 345 ((MASK) == RTC_AlarmSubSecondMask_SS14_12) || \
MartinJohnson 0:404f5a4f1385 346 ((MASK) == RTC_AlarmSubSecondMask_SS14_13) || \
MartinJohnson 0:404f5a4f1385 347 ((MASK) == RTC_AlarmSubSecondMask_SS14) || \
MartinJohnson 0:404f5a4f1385 348 ((MASK) == RTC_AlarmSubSecondMask_None))
MartinJohnson 0:404f5a4f1385 349 /**
MartinJohnson 0:404f5a4f1385 350 * @}
MartinJohnson 0:404f5a4f1385 351 */
MartinJohnson 0:404f5a4f1385 352
MartinJohnson 0:404f5a4f1385 353 /** @defgroup RTC_Alarm_Sub_Seconds_Value
MartinJohnson 0:404f5a4f1385 354 * @{
MartinJohnson 0:404f5a4f1385 355 */
MartinJohnson 0:404f5a4f1385 356
MartinJohnson 0:404f5a4f1385 357 #define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= 0x00007FFF)
MartinJohnson 0:404f5a4f1385 358
MartinJohnson 0:404f5a4f1385 359 /**
MartinJohnson 0:404f5a4f1385 360 * @}
MartinJohnson 0:404f5a4f1385 361 */
MartinJohnson 0:404f5a4f1385 362
MartinJohnson 0:404f5a4f1385 363 /** @defgroup RTC_Wakeup_Timer_Definitions
MartinJohnson 0:404f5a4f1385 364 * @{
MartinJohnson 0:404f5a4f1385 365 */
MartinJohnson 0:404f5a4f1385 366 #define RTC_WakeUpClock_RTCCLK_Div16 ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 367 #define RTC_WakeUpClock_RTCCLK_Div8 ((uint32_t)0x00000001)
MartinJohnson 0:404f5a4f1385 368 #define RTC_WakeUpClock_RTCCLK_Div4 ((uint32_t)0x00000002)
MartinJohnson 0:404f5a4f1385 369 #define RTC_WakeUpClock_RTCCLK_Div2 ((uint32_t)0x00000003)
MartinJohnson 0:404f5a4f1385 370 #define RTC_WakeUpClock_CK_SPRE_16bits ((uint32_t)0x00000004)
MartinJohnson 0:404f5a4f1385 371 #define RTC_WakeUpClock_CK_SPRE_17bits ((uint32_t)0x00000006)
MartinJohnson 0:404f5a4f1385 372 #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WakeUpClock_RTCCLK_Div16) || \
MartinJohnson 0:404f5a4f1385 373 ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div8) || \
MartinJohnson 0:404f5a4f1385 374 ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div4) || \
MartinJohnson 0:404f5a4f1385 375 ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div2) || \
MartinJohnson 0:404f5a4f1385 376 ((CLOCK) == RTC_WakeUpClock_CK_SPRE_16bits) || \
MartinJohnson 0:404f5a4f1385 377 ((CLOCK) == RTC_WakeUpClock_CK_SPRE_17bits))
MartinJohnson 0:404f5a4f1385 378 #define IS_RTC_WAKEUP_COUNTER(COUNTER) ((COUNTER) <= 0xFFFF)
MartinJohnson 0:404f5a4f1385 379 /**
MartinJohnson 0:404f5a4f1385 380 * @}
MartinJohnson 0:404f5a4f1385 381 */
MartinJohnson 0:404f5a4f1385 382
MartinJohnson 0:404f5a4f1385 383 /** @defgroup RTC_Time_Stamp_Edges_definitions
MartinJohnson 0:404f5a4f1385 384 * @{
MartinJohnson 0:404f5a4f1385 385 */
MartinJohnson 0:404f5a4f1385 386 #define RTC_TimeStampEdge_Rising ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 387 #define RTC_TimeStampEdge_Falling ((uint32_t)0x00000008)
MartinJohnson 0:404f5a4f1385 388 #define IS_RTC_TIMESTAMP_EDGE(EDGE) (((EDGE) == RTC_TimeStampEdge_Rising) || \
MartinJohnson 0:404f5a4f1385 389 ((EDGE) == RTC_TimeStampEdge_Falling))
MartinJohnson 0:404f5a4f1385 390 /**
MartinJohnson 0:404f5a4f1385 391 * @}
MartinJohnson 0:404f5a4f1385 392 */
MartinJohnson 0:404f5a4f1385 393
MartinJohnson 0:404f5a4f1385 394 /** @defgroup RTC_Output_selection_Definitions
MartinJohnson 0:404f5a4f1385 395 * @{
MartinJohnson 0:404f5a4f1385 396 */
MartinJohnson 0:404f5a4f1385 397 #define RTC_Output_Disable ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 398 #define RTC_Output_AlarmA ((uint32_t)0x00200000)
MartinJohnson 0:404f5a4f1385 399 #define RTC_Output_AlarmB ((uint32_t)0x00400000)
MartinJohnson 0:404f5a4f1385 400 #define RTC_Output_WakeUp ((uint32_t)0x00600000)
MartinJohnson 0:404f5a4f1385 401
MartinJohnson 0:404f5a4f1385 402 #define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_Output_Disable) || \
MartinJohnson 0:404f5a4f1385 403 ((OUTPUT) == RTC_Output_AlarmA) || \
MartinJohnson 0:404f5a4f1385 404 ((OUTPUT) == RTC_Output_AlarmB) || \
MartinJohnson 0:404f5a4f1385 405 ((OUTPUT) == RTC_Output_WakeUp))
MartinJohnson 0:404f5a4f1385 406
MartinJohnson 0:404f5a4f1385 407 /**
MartinJohnson 0:404f5a4f1385 408 * @}
MartinJohnson 0:404f5a4f1385 409 */
MartinJohnson 0:404f5a4f1385 410
MartinJohnson 0:404f5a4f1385 411 /** @defgroup RTC_Output_Polarity_Definitions
MartinJohnson 0:404f5a4f1385 412 * @{
MartinJohnson 0:404f5a4f1385 413 */
MartinJohnson 0:404f5a4f1385 414 #define RTC_OutputPolarity_High ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 415 #define RTC_OutputPolarity_Low ((uint32_t)0x00100000)
MartinJohnson 0:404f5a4f1385 416 #define IS_RTC_OUTPUT_POL(POL) (((POL) == RTC_OutputPolarity_High) || \
MartinJohnson 0:404f5a4f1385 417 ((POL) == RTC_OutputPolarity_Low))
MartinJohnson 0:404f5a4f1385 418 /**
MartinJohnson 0:404f5a4f1385 419 * @}
MartinJohnson 0:404f5a4f1385 420 */
MartinJohnson 0:404f5a4f1385 421
MartinJohnson 0:404f5a4f1385 422 /** @defgroup RTC_Digital_Calibration_Definitions
MartinJohnson 0:404f5a4f1385 423 * @{
MartinJohnson 0:404f5a4f1385 424 */
MartinJohnson 0:404f5a4f1385 425 #define RTC_CalibSign_Positive ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 426 #define RTC_CalibSign_Negative ((uint32_t)0x00000080)
MartinJohnson 0:404f5a4f1385 427 #define IS_RTC_CALIB_SIGN(SIGN) (((SIGN) == RTC_CalibSign_Positive) || \
MartinJohnson 0:404f5a4f1385 428 ((SIGN) == RTC_CalibSign_Negative))
MartinJohnson 0:404f5a4f1385 429 #define IS_RTC_CALIB_VALUE(VALUE) ((VALUE) < 0x20)
MartinJohnson 0:404f5a4f1385 430
MartinJohnson 0:404f5a4f1385 431 /**
MartinJohnson 0:404f5a4f1385 432 * @}
MartinJohnson 0:404f5a4f1385 433 */
MartinJohnson 0:404f5a4f1385 434
MartinJohnson 0:404f5a4f1385 435 /** @defgroup RTC_Calib_Output_selection_Definitions
MartinJohnson 0:404f5a4f1385 436 * @{
MartinJohnson 0:404f5a4f1385 437 */
MartinJohnson 0:404f5a4f1385 438 #define RTC_CalibOutput_512Hz ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 439 #define RTC_CalibOutput_1Hz ((uint32_t)0x00080000)
MartinJohnson 0:404f5a4f1385 440 #define IS_RTC_CALIB_OUTPUT(OUTPUT) (((OUTPUT) == RTC_CalibOutput_512Hz) || \
MartinJohnson 0:404f5a4f1385 441 ((OUTPUT) == RTC_CalibOutput_1Hz))
MartinJohnson 0:404f5a4f1385 442 /**
MartinJohnson 0:404f5a4f1385 443 * @}
MartinJohnson 0:404f5a4f1385 444 */
MartinJohnson 0:404f5a4f1385 445
MartinJohnson 0:404f5a4f1385 446 /** @defgroup RTC_Smooth_calib_period_Definitions
MartinJohnson 0:404f5a4f1385 447 * @{
MartinJohnson 0:404f5a4f1385 448 */
MartinJohnson 0:404f5a4f1385 449 #define RTC_SmoothCalibPeriod_32sec ((uint32_t)0x00000000) /*!< if RTCCLK = 32768 Hz, Smooth calibation
MartinJohnson 0:404f5a4f1385 450 period is 32s, else 2exp20 RTCCLK seconds */
MartinJohnson 0:404f5a4f1385 451 #define RTC_SmoothCalibPeriod_16sec ((uint32_t)0x00002000) /*!< if RTCCLK = 32768 Hz, Smooth calibation
MartinJohnson 0:404f5a4f1385 452 period is 16s, else 2exp19 RTCCLK seconds */
MartinJohnson 0:404f5a4f1385 453 #define RTC_SmoothCalibPeriod_8sec ((uint32_t)0x00004000) /*!< if RTCCLK = 32768 Hz, Smooth calibation
MartinJohnson 0:404f5a4f1385 454 period is 8s, else 2exp18 RTCCLK seconds */
MartinJohnson 0:404f5a4f1385 455 #define IS_RTC_SMOOTH_CALIB_PERIOD(PERIOD) (((PERIOD) == RTC_SmoothCalibPeriod_32sec) || \
MartinJohnson 0:404f5a4f1385 456 ((PERIOD) == RTC_SmoothCalibPeriod_16sec) || \
MartinJohnson 0:404f5a4f1385 457 ((PERIOD) == RTC_SmoothCalibPeriod_8sec))
MartinJohnson 0:404f5a4f1385 458
MartinJohnson 0:404f5a4f1385 459 /**
MartinJohnson 0:404f5a4f1385 460 * @}
MartinJohnson 0:404f5a4f1385 461 */
MartinJohnson 0:404f5a4f1385 462
MartinJohnson 0:404f5a4f1385 463 /** @defgroup RTC_Smooth_calib_Plus_pulses_Definitions
MartinJohnson 0:404f5a4f1385 464 * @{
MartinJohnson 0:404f5a4f1385 465 */
MartinJohnson 0:404f5a4f1385 466 #define RTC_SmoothCalibPlusPulses_Set ((uint32_t)0x00008000) /*!< The number of RTCCLK pulses added
MartinJohnson 0:404f5a4f1385 467 during a X -second window = Y - CALM[8:0].
MartinJohnson 0:404f5a4f1385 468 with Y = 512, 256, 128 when X = 32, 16, 8 */
MartinJohnson 0:404f5a4f1385 469 #define RTC_SmoothCalibPlusPulses_Reset ((uint32_t)0x00000000) /*!< The number of RTCCLK pulses subbstited
MartinJohnson 0:404f5a4f1385 470 during a 32-second window = CALM[8:0]. */
MartinJohnson 0:404f5a4f1385 471 #define IS_RTC_SMOOTH_CALIB_PLUS(PLUS) (((PLUS) == RTC_SmoothCalibPlusPulses_Set) || \
MartinJohnson 0:404f5a4f1385 472 ((PLUS) == RTC_SmoothCalibPlusPulses_Reset))
MartinJohnson 0:404f5a4f1385 473
MartinJohnson 0:404f5a4f1385 474 /**
MartinJohnson 0:404f5a4f1385 475 * @}
MartinJohnson 0:404f5a4f1385 476 */
MartinJohnson 0:404f5a4f1385 477
MartinJohnson 0:404f5a4f1385 478 /** @defgroup RTC_Smooth_calib_Minus_pulses_Definitions
MartinJohnson 0:404f5a4f1385 479 * @{
MartinJohnson 0:404f5a4f1385 480 */
MartinJohnson 0:404f5a4f1385 481 #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x000001FF)
MartinJohnson 0:404f5a4f1385 482
MartinJohnson 0:404f5a4f1385 483 /**
MartinJohnson 0:404f5a4f1385 484 * @}
MartinJohnson 0:404f5a4f1385 485 */
MartinJohnson 0:404f5a4f1385 486
MartinJohnson 0:404f5a4f1385 487 /** @defgroup RTC_DayLightSaving_Definitions
MartinJohnson 0:404f5a4f1385 488 * @{
MartinJohnson 0:404f5a4f1385 489 */
MartinJohnson 0:404f5a4f1385 490 #define RTC_DayLightSaving_SUB1H ((uint32_t)0x00020000)
MartinJohnson 0:404f5a4f1385 491 #define RTC_DayLightSaving_ADD1H ((uint32_t)0x00010000)
MartinJohnson 0:404f5a4f1385 492 #define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DayLightSaving_SUB1H) || \
MartinJohnson 0:404f5a4f1385 493 ((SAVE) == RTC_DayLightSaving_ADD1H))
MartinJohnson 0:404f5a4f1385 494
MartinJohnson 0:404f5a4f1385 495 #define RTC_StoreOperation_Reset ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 496 #define RTC_StoreOperation_Set ((uint32_t)0x00040000)
MartinJohnson 0:404f5a4f1385 497 #define IS_RTC_STORE_OPERATION(OPERATION) (((OPERATION) == RTC_StoreOperation_Reset) || \
MartinJohnson 0:404f5a4f1385 498 ((OPERATION) == RTC_StoreOperation_Set))
MartinJohnson 0:404f5a4f1385 499 /**
MartinJohnson 0:404f5a4f1385 500 * @}
MartinJohnson 0:404f5a4f1385 501 */
MartinJohnson 0:404f5a4f1385 502
MartinJohnson 0:404f5a4f1385 503 /** @defgroup RTC_Tamper_Trigger_Definitions
MartinJohnson 0:404f5a4f1385 504 * @{
MartinJohnson 0:404f5a4f1385 505 */
MartinJohnson 0:404f5a4f1385 506 #define RTC_TamperTrigger_RisingEdge ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 507 #define RTC_TamperTrigger_FallingEdge ((uint32_t)0x00000001)
MartinJohnson 0:404f5a4f1385 508 #define RTC_TamperTrigger_LowLevel ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 509 #define RTC_TamperTrigger_HighLevel ((uint32_t)0x00000001)
MartinJohnson 0:404f5a4f1385 510 #define IS_RTC_TAMPER_TRIGGER(TRIGGER) (((TRIGGER) == RTC_TamperTrigger_RisingEdge) || \
MartinJohnson 0:404f5a4f1385 511 ((TRIGGER) == RTC_TamperTrigger_FallingEdge) || \
MartinJohnson 0:404f5a4f1385 512 ((TRIGGER) == RTC_TamperTrigger_LowLevel) || \
MartinJohnson 0:404f5a4f1385 513 ((TRIGGER) == RTC_TamperTrigger_HighLevel))
MartinJohnson 0:404f5a4f1385 514
MartinJohnson 0:404f5a4f1385 515 /**
MartinJohnson 0:404f5a4f1385 516 * @}
MartinJohnson 0:404f5a4f1385 517 */
MartinJohnson 0:404f5a4f1385 518
MartinJohnson 0:404f5a4f1385 519 /** @defgroup RTC_Tamper_Filter_Definitions
MartinJohnson 0:404f5a4f1385 520 * @{
MartinJohnson 0:404f5a4f1385 521 */
MartinJohnson 0:404f5a4f1385 522 #define RTC_TamperFilter_Disable ((uint32_t)0x00000000) /*!< Tamper filter is disabled */
MartinJohnson 0:404f5a4f1385 523
MartinJohnson 0:404f5a4f1385 524 #define RTC_TamperFilter_2Sample ((uint32_t)0x00000800) /*!< Tamper is activated after 2
MartinJohnson 0:404f5a4f1385 525 consecutive samples at the active level */
MartinJohnson 0:404f5a4f1385 526 #define RTC_TamperFilter_4Sample ((uint32_t)0x00001000) /*!< Tamper is activated after 4
MartinJohnson 0:404f5a4f1385 527 consecutive samples at the active level */
MartinJohnson 0:404f5a4f1385 528 #define RTC_TamperFilter_8Sample ((uint32_t)0x00001800) /*!< Tamper is activated after 8
MartinJohnson 0:404f5a4f1385 529 consecutive samples at the active leve. */
MartinJohnson 0:404f5a4f1385 530 #define IS_RTC_TAMPER_FILTER(FILTER) (((FILTER) == RTC_TamperFilter_Disable) || \
MartinJohnson 0:404f5a4f1385 531 ((FILTER) == RTC_TamperFilter_2Sample) || \
MartinJohnson 0:404f5a4f1385 532 ((FILTER) == RTC_TamperFilter_4Sample) || \
MartinJohnson 0:404f5a4f1385 533 ((FILTER) == RTC_TamperFilter_8Sample))
MartinJohnson 0:404f5a4f1385 534 /**
MartinJohnson 0:404f5a4f1385 535 * @}
MartinJohnson 0:404f5a4f1385 536 */
MartinJohnson 0:404f5a4f1385 537
MartinJohnson 0:404f5a4f1385 538 /** @defgroup RTC_Tamper_Sampling_Frequencies_Definitions
MartinJohnson 0:404f5a4f1385 539 * @{
MartinJohnson 0:404f5a4f1385 540 */
MartinJohnson 0:404f5a4f1385 541 #define RTC_TamperSamplingFreq_RTCCLK_Div32768 ((uint32_t)0x00000000) /*!< Each of the tamper inputs are sampled
MartinJohnson 0:404f5a4f1385 542 with a frequency = RTCCLK / 32768 */
MartinJohnson 0:404f5a4f1385 543 #define RTC_TamperSamplingFreq_RTCCLK_Div16384 ((uint32_t)0x000000100) /*!< Each of the tamper inputs are sampled
MartinJohnson 0:404f5a4f1385 544 with a frequency = RTCCLK / 16384 */
MartinJohnson 0:404f5a4f1385 545 #define RTC_TamperSamplingFreq_RTCCLK_Div8192 ((uint32_t)0x00000200) /*!< Each of the tamper inputs are sampled
MartinJohnson 0:404f5a4f1385 546 with a frequency = RTCCLK / 8192 */
MartinJohnson 0:404f5a4f1385 547 #define RTC_TamperSamplingFreq_RTCCLK_Div4096 ((uint32_t)0x00000300) /*!< Each of the tamper inputs are sampled
MartinJohnson 0:404f5a4f1385 548 with a frequency = RTCCLK / 4096 */
MartinJohnson 0:404f5a4f1385 549 #define RTC_TamperSamplingFreq_RTCCLK_Div2048 ((uint32_t)0x00000400) /*!< Each of the tamper inputs are sampled
MartinJohnson 0:404f5a4f1385 550 with a frequency = RTCCLK / 2048 */
MartinJohnson 0:404f5a4f1385 551 #define RTC_TamperSamplingFreq_RTCCLK_Div1024 ((uint32_t)0x00000500) /*!< Each of the tamper inputs are sampled
MartinJohnson 0:404f5a4f1385 552 with a frequency = RTCCLK / 1024 */
MartinJohnson 0:404f5a4f1385 553 #define RTC_TamperSamplingFreq_RTCCLK_Div512 ((uint32_t)0x00000600) /*!< Each of the tamper inputs are sampled
MartinJohnson 0:404f5a4f1385 554 with a frequency = RTCCLK / 512 */
MartinJohnson 0:404f5a4f1385 555 #define RTC_TamperSamplingFreq_RTCCLK_Div256 ((uint32_t)0x00000700) /*!< Each of the tamper inputs are sampled
MartinJohnson 0:404f5a4f1385 556 with a frequency = RTCCLK / 256 */
MartinJohnson 0:404f5a4f1385 557 #define IS_RTC_TAMPER_SAMPLING_FREQ(FREQ) (((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div32768) || \
MartinJohnson 0:404f5a4f1385 558 ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div16384) || \
MartinJohnson 0:404f5a4f1385 559 ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div8192) || \
MartinJohnson 0:404f5a4f1385 560 ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div4096) || \
MartinJohnson 0:404f5a4f1385 561 ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div2048) || \
MartinJohnson 0:404f5a4f1385 562 ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div1024) || \
MartinJohnson 0:404f5a4f1385 563 ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div512) || \
MartinJohnson 0:404f5a4f1385 564 ((FREQ) ==RTC_TamperSamplingFreq_RTCCLK_Div256))
MartinJohnson 0:404f5a4f1385 565
MartinJohnson 0:404f5a4f1385 566 /**
MartinJohnson 0:404f5a4f1385 567 * @}
MartinJohnson 0:404f5a4f1385 568 */
MartinJohnson 0:404f5a4f1385 569
MartinJohnson 0:404f5a4f1385 570 /** @defgroup RTC_Tamper_Pin_Precharge_Duration_Definitions
MartinJohnson 0:404f5a4f1385 571 * @{
MartinJohnson 0:404f5a4f1385 572 */
MartinJohnson 0:404f5a4f1385 573 #define RTC_TamperPrechargeDuration_1RTCCLK ((uint32_t)0x00000000) /*!< Tamper pins are pre-charged before
MartinJohnson 0:404f5a4f1385 574 sampling during 1 RTCCLK cycle */
MartinJohnson 0:404f5a4f1385 575 #define RTC_TamperPrechargeDuration_2RTCCLK ((uint32_t)0x00002000) /*!< Tamper pins are pre-charged before
MartinJohnson 0:404f5a4f1385 576 sampling during 2 RTCCLK cycles */
MartinJohnson 0:404f5a4f1385 577 #define RTC_TamperPrechargeDuration_4RTCCLK ((uint32_t)0x00004000) /*!< Tamper pins are pre-charged before
MartinJohnson 0:404f5a4f1385 578 sampling during 4 RTCCLK cycles */
MartinJohnson 0:404f5a4f1385 579 #define RTC_TamperPrechargeDuration_8RTCCLK ((uint32_t)0x00006000) /*!< Tamper pins are pre-charged before
MartinJohnson 0:404f5a4f1385 580 sampling during 8 RTCCLK cycles */
MartinJohnson 0:404f5a4f1385 581
MartinJohnson 0:404f5a4f1385 582 #define IS_RTC_TAMPER_PRECHARGE_DURATION(DURATION) (((DURATION) == RTC_TamperPrechargeDuration_1RTCCLK) || \
MartinJohnson 0:404f5a4f1385 583 ((DURATION) == RTC_TamperPrechargeDuration_2RTCCLK) || \
MartinJohnson 0:404f5a4f1385 584 ((DURATION) == RTC_TamperPrechargeDuration_4RTCCLK) || \
MartinJohnson 0:404f5a4f1385 585 ((DURATION) == RTC_TamperPrechargeDuration_8RTCCLK))
MartinJohnson 0:404f5a4f1385 586 /**
MartinJohnson 0:404f5a4f1385 587 * @}
MartinJohnson 0:404f5a4f1385 588 */
MartinJohnson 0:404f5a4f1385 589
MartinJohnson 0:404f5a4f1385 590 /** @defgroup RTC_Tamper_Pins_Definitions
MartinJohnson 0:404f5a4f1385 591 * @{
MartinJohnson 0:404f5a4f1385 592 */
MartinJohnson 0:404f5a4f1385 593 #define RTC_Tamper_1 RTC_TAFCR_TAMP1E /*!< Tamper detection enable for
MartinJohnson 0:404f5a4f1385 594 input tamper 1 */
MartinJohnson 0:404f5a4f1385 595 #define RTC_Tamper_2 RTC_TAFCR_TAMP2E /*!< Tamper detection enable for
MartinJohnson 0:404f5a4f1385 596 input tamper 2 */
MartinJohnson 0:404f5a4f1385 597 #define RTC_Tamper_3 RTC_TAFCR_TAMP3E /*!< Tamper detection enable for
MartinJohnson 0:404f5a4f1385 598 input tamper 3 */
MartinJohnson 0:404f5a4f1385 599
MartinJohnson 0:404f5a4f1385 600 #define IS_RTC_TAMPER(TAMPER) ((((TAMPER) & (uint32_t)0xFFFFFFD6) == 0x00) && ((TAMPER) != (uint32_t)RESET))
MartinJohnson 0:404f5a4f1385 601
MartinJohnson 0:404f5a4f1385 602
MartinJohnson 0:404f5a4f1385 603 /**
MartinJohnson 0:404f5a4f1385 604 * @}
MartinJohnson 0:404f5a4f1385 605 */
MartinJohnson 0:404f5a4f1385 606
MartinJohnson 0:404f5a4f1385 607 /** @defgroup RTC_Output_Type_ALARM_OUT
MartinJohnson 0:404f5a4f1385 608 * @{
MartinJohnson 0:404f5a4f1385 609 */
MartinJohnson 0:404f5a4f1385 610 #define RTC_OutputType_OpenDrain ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 611 #define RTC_OutputType_PushPull ((uint32_t)0x00040000)
MartinJohnson 0:404f5a4f1385 612 #define IS_RTC_OUTPUT_TYPE(TYPE) (((TYPE) == RTC_OutputType_OpenDrain) || \
MartinJohnson 0:404f5a4f1385 613 ((TYPE) == RTC_OutputType_PushPull))
MartinJohnson 0:404f5a4f1385 614
MartinJohnson 0:404f5a4f1385 615 /**
MartinJohnson 0:404f5a4f1385 616 * @}
MartinJohnson 0:404f5a4f1385 617 */
MartinJohnson 0:404f5a4f1385 618
MartinJohnson 0:404f5a4f1385 619 /** @defgroup RTC_Add_1_Second_Parameter_Definitions
MartinJohnson 0:404f5a4f1385 620 * @{
MartinJohnson 0:404f5a4f1385 621 */
MartinJohnson 0:404f5a4f1385 622 #define RTC_ShiftAdd1S_Reset ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 623 #define RTC_ShiftAdd1S_Set ((uint32_t)0x80000000)
MartinJohnson 0:404f5a4f1385 624 #define IS_RTC_SHIFT_ADD1S(SEL) (((SEL) == RTC_ShiftAdd1S_Reset) || \
MartinJohnson 0:404f5a4f1385 625 ((SEL) == RTC_ShiftAdd1S_Set))
MartinJohnson 0:404f5a4f1385 626 /**
MartinJohnson 0:404f5a4f1385 627 * @}
MartinJohnson 0:404f5a4f1385 628 */
MartinJohnson 0:404f5a4f1385 629
MartinJohnson 0:404f5a4f1385 630 /** @defgroup RTC_Substract_Fraction_Of_Second_Value
MartinJohnson 0:404f5a4f1385 631 * @{
MartinJohnson 0:404f5a4f1385 632 */
MartinJohnson 0:404f5a4f1385 633 #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x00007FFF)
MartinJohnson 0:404f5a4f1385 634
MartinJohnson 0:404f5a4f1385 635 /**
MartinJohnson 0:404f5a4f1385 636 * @}
MartinJohnson 0:404f5a4f1385 637 */
MartinJohnson 0:404f5a4f1385 638
MartinJohnson 0:404f5a4f1385 639 /** @defgroup RTC_Backup_Registers_Definitions
MartinJohnson 0:404f5a4f1385 640 * @{
MartinJohnson 0:404f5a4f1385 641 */
MartinJohnson 0:404f5a4f1385 642
MartinJohnson 0:404f5a4f1385 643 #define RTC_BKP_DR0 ((uint32_t)0x00000000)
MartinJohnson 0:404f5a4f1385 644 #define RTC_BKP_DR1 ((uint32_t)0x00000001)
MartinJohnson 0:404f5a4f1385 645 #define RTC_BKP_DR2 ((uint32_t)0x00000002)
MartinJohnson 0:404f5a4f1385 646 #define RTC_BKP_DR3 ((uint32_t)0x00000003)
MartinJohnson 0:404f5a4f1385 647 #define RTC_BKP_DR4 ((uint32_t)0x00000004)
MartinJohnson 0:404f5a4f1385 648 #define RTC_BKP_DR5 ((uint32_t)0x00000005)
MartinJohnson 0:404f5a4f1385 649 #define RTC_BKP_DR6 ((uint32_t)0x00000006)
MartinJohnson 0:404f5a4f1385 650 #define RTC_BKP_DR7 ((uint32_t)0x00000007)
MartinJohnson 0:404f5a4f1385 651 #define RTC_BKP_DR8 ((uint32_t)0x00000008)
MartinJohnson 0:404f5a4f1385 652 #define RTC_BKP_DR9 ((uint32_t)0x00000009)
MartinJohnson 0:404f5a4f1385 653 #define RTC_BKP_DR10 ((uint32_t)0x0000000A)
MartinJohnson 0:404f5a4f1385 654 #define RTC_BKP_DR11 ((uint32_t)0x0000000B)
MartinJohnson 0:404f5a4f1385 655 #define RTC_BKP_DR12 ((uint32_t)0x0000000C)
MartinJohnson 0:404f5a4f1385 656 #define RTC_BKP_DR13 ((uint32_t)0x0000000D)
MartinJohnson 0:404f5a4f1385 657 #define RTC_BKP_DR14 ((uint32_t)0x0000000E)
MartinJohnson 0:404f5a4f1385 658 #define RTC_BKP_DR15 ((uint32_t)0x0000000F)
MartinJohnson 0:404f5a4f1385 659 #define IS_RTC_BKP(BKP) (((BKP) == RTC_BKP_DR0) || \
MartinJohnson 0:404f5a4f1385 660 ((BKP) == RTC_BKP_DR1) || \
MartinJohnson 0:404f5a4f1385 661 ((BKP) == RTC_BKP_DR2) || \
MartinJohnson 0:404f5a4f1385 662 ((BKP) == RTC_BKP_DR3) || \
MartinJohnson 0:404f5a4f1385 663 ((BKP) == RTC_BKP_DR4) || \
MartinJohnson 0:404f5a4f1385 664 ((BKP) == RTC_BKP_DR5) || \
MartinJohnson 0:404f5a4f1385 665 ((BKP) == RTC_BKP_DR6) || \
MartinJohnson 0:404f5a4f1385 666 ((BKP) == RTC_BKP_DR7) || \
MartinJohnson 0:404f5a4f1385 667 ((BKP) == RTC_BKP_DR8) || \
MartinJohnson 0:404f5a4f1385 668 ((BKP) == RTC_BKP_DR9) || \
MartinJohnson 0:404f5a4f1385 669 ((BKP) == RTC_BKP_DR10) || \
MartinJohnson 0:404f5a4f1385 670 ((BKP) == RTC_BKP_DR11) || \
MartinJohnson 0:404f5a4f1385 671 ((BKP) == RTC_BKP_DR12) || \
MartinJohnson 0:404f5a4f1385 672 ((BKP) == RTC_BKP_DR13) || \
MartinJohnson 0:404f5a4f1385 673 ((BKP) == RTC_BKP_DR14) || \
MartinJohnson 0:404f5a4f1385 674 ((BKP) == RTC_BKP_DR15))
MartinJohnson 0:404f5a4f1385 675 /**
MartinJohnson 0:404f5a4f1385 676 * @}
MartinJohnson 0:404f5a4f1385 677 */
MartinJohnson 0:404f5a4f1385 678
MartinJohnson 0:404f5a4f1385 679 /** @defgroup RTC_Input_parameter_format_definitions
MartinJohnson 0:404f5a4f1385 680 * @{
MartinJohnson 0:404f5a4f1385 681 */
MartinJohnson 0:404f5a4f1385 682 #define RTC_Format_BIN ((uint32_t)0x000000000)
MartinJohnson 0:404f5a4f1385 683 #define RTC_Format_BCD ((uint32_t)0x000000001)
MartinJohnson 0:404f5a4f1385 684 #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_Format_BIN) || ((FORMAT) == RTC_Format_BCD))
MartinJohnson 0:404f5a4f1385 685
MartinJohnson 0:404f5a4f1385 686 /**
MartinJohnson 0:404f5a4f1385 687 * @}
MartinJohnson 0:404f5a4f1385 688 */
MartinJohnson 0:404f5a4f1385 689
MartinJohnson 0:404f5a4f1385 690 /** @defgroup RTC_Flags_Definitions
MartinJohnson 0:404f5a4f1385 691 * @{
MartinJohnson 0:404f5a4f1385 692 */
MartinJohnson 0:404f5a4f1385 693 #define RTC_FLAG_RECALPF ((uint32_t)0x00010000)
MartinJohnson 0:404f5a4f1385 694 #define RTC_FLAG_TAMP3F ((uint32_t)0x00008000)
MartinJohnson 0:404f5a4f1385 695 #define RTC_FLAG_TAMP2F ((uint32_t)0x00004000)
MartinJohnson 0:404f5a4f1385 696 #define RTC_FLAG_TAMP1F ((uint32_t)0x00002000)
MartinJohnson 0:404f5a4f1385 697 #define RTC_FLAG_TSOVF ((uint32_t)0x00001000)
MartinJohnson 0:404f5a4f1385 698 #define RTC_FLAG_TSF ((uint32_t)0x00000800)
MartinJohnson 0:404f5a4f1385 699 #define RTC_FLAG_WUTF ((uint32_t)0x00000400)
MartinJohnson 0:404f5a4f1385 700 #define RTC_FLAG_ALRBF ((uint32_t)0x00000200)
MartinJohnson 0:404f5a4f1385 701 #define RTC_FLAG_ALRAF ((uint32_t)0x00000100)
MartinJohnson 0:404f5a4f1385 702 #define RTC_FLAG_INITF ((uint32_t)0x00000040)
MartinJohnson 0:404f5a4f1385 703 #define RTC_FLAG_RSF ((uint32_t)0x00000020)
MartinJohnson 0:404f5a4f1385 704 #define RTC_FLAG_INITS ((uint32_t)0x00000010)
MartinJohnson 0:404f5a4f1385 705 #define RTC_FLAG_SHPF ((uint32_t)0x00000008)
MartinJohnson 0:404f5a4f1385 706 #define RTC_FLAG_WUTWF ((uint32_t)0x00000004)
MartinJohnson 0:404f5a4f1385 707 #define RTC_FLAG_ALRBWF ((uint32_t)0x00000002)
MartinJohnson 0:404f5a4f1385 708 #define RTC_FLAG_ALRAWF ((uint32_t)0x00000001)
MartinJohnson 0:404f5a4f1385 709 #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_TSOVF) || ((FLAG) == RTC_FLAG_TSF) || \
MartinJohnson 0:404f5a4f1385 710 ((FLAG) == RTC_FLAG_WUTF) || ((FLAG) == RTC_FLAG_ALRBF) || \
MartinJohnson 0:404f5a4f1385 711 ((FLAG) == RTC_FLAG_ALRAF) || ((FLAG) == RTC_FLAG_INITF) || \
MartinJohnson 0:404f5a4f1385 712 ((FLAG) == RTC_FLAG_RSF) || ((FLAG) == RTC_FLAG_WUTWF) || \
MartinJohnson 0:404f5a4f1385 713 ((FLAG) == RTC_FLAG_ALRBWF) || ((FLAG) == RTC_FLAG_ALRAWF) || \
MartinJohnson 0:404f5a4f1385 714 ((FLAG) == RTC_FLAG_TAMP1F) || ((FLAG) == RTC_FLAG_TAMP2F) || \
MartinJohnson 0:404f5a4f1385 715 ((FLAG) == RTC_FLAG_TAMP3F) || ((FLAG) == RTC_FLAG_RECALPF) || \
MartinJohnson 0:404f5a4f1385 716 ((FLAG) == RTC_FLAG_SHPF))
MartinJohnson 0:404f5a4f1385 717 #define IS_RTC_CLEAR_FLAG(FLAG) (((FLAG) != (uint32_t)RESET) && (((FLAG) & 0xFFFF00DF) == (uint32_t)RESET))
MartinJohnson 0:404f5a4f1385 718
MartinJohnson 0:404f5a4f1385 719 /**
MartinJohnson 0:404f5a4f1385 720 * @}
MartinJohnson 0:404f5a4f1385 721 */
MartinJohnson 0:404f5a4f1385 722
MartinJohnson 0:404f5a4f1385 723 /** @defgroup RTC_Interrupts_Definitions
MartinJohnson 0:404f5a4f1385 724 * @{
MartinJohnson 0:404f5a4f1385 725 */
MartinJohnson 0:404f5a4f1385 726 #define RTC_IT_TS ((uint32_t)0x00008000)
MartinJohnson 0:404f5a4f1385 727 #define RTC_IT_WUT ((uint32_t)0x00004000)
MartinJohnson 0:404f5a4f1385 728 #define RTC_IT_ALRB ((uint32_t)0x00002000)
MartinJohnson 0:404f5a4f1385 729 #define RTC_IT_ALRA ((uint32_t)0x00001000)
MartinJohnson 0:404f5a4f1385 730 #define RTC_IT_TAMP ((uint32_t)0x00000004) /* Used only to Enable the Tamper Interrupt */
MartinJohnson 0:404f5a4f1385 731 #define RTC_IT_TAMP1 ((uint32_t)0x00020000)
MartinJohnson 0:404f5a4f1385 732 #define RTC_IT_TAMP2 ((uint32_t)0x00040000)
MartinJohnson 0:404f5a4f1385 733 #define RTC_IT_TAMP3 ((uint32_t)0x00080000)
MartinJohnson 0:404f5a4f1385 734
MartinJohnson 0:404f5a4f1385 735
MartinJohnson 0:404f5a4f1385 736 #define IS_RTC_CONFIG_IT(IT) (((IT) != (uint32_t)RESET) && (((IT) & 0xFFFF0FFB) == (uint32_t)RESET))
MartinJohnson 0:404f5a4f1385 737 #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_TS) || ((IT) == RTC_IT_WUT) || \
MartinJohnson 0:404f5a4f1385 738 ((IT) == RTC_IT_ALRB) || ((IT) == RTC_IT_ALRA) || \
MartinJohnson 0:404f5a4f1385 739 ((IT) == RTC_IT_TAMP1) || ((IT) == RTC_IT_TAMP2) || \
MartinJohnson 0:404f5a4f1385 740 ((IT) == RTC_IT_TAMP3))
MartinJohnson 0:404f5a4f1385 741 #define IS_RTC_CLEAR_IT(IT) (((IT) != (uint32_t)RESET) && (((IT) & 0xFFF10FFF) == (uint32_t)RESET))
MartinJohnson 0:404f5a4f1385 742
MartinJohnson 0:404f5a4f1385 743 /**
MartinJohnson 0:404f5a4f1385 744 * @}
MartinJohnson 0:404f5a4f1385 745 */
MartinJohnson 0:404f5a4f1385 746
MartinJohnson 0:404f5a4f1385 747 /**
MartinJohnson 0:404f5a4f1385 748 * @}
MartinJohnson 0:404f5a4f1385 749 */
MartinJohnson 0:404f5a4f1385 750
MartinJohnson 0:404f5a4f1385 751
MartinJohnson 0:404f5a4f1385 752 /* Exported macro ------------------------------------------------------------*/
MartinJohnson 0:404f5a4f1385 753 /* Exported functions ------------------------------------------------------- */
MartinJohnson 0:404f5a4f1385 754
MartinJohnson 0:404f5a4f1385 755 /* Function used to set the RTC configuration to the default reset state *****/
MartinJohnson 0:404f5a4f1385 756 ErrorStatus RTC_DeInit(void);
MartinJohnson 0:404f5a4f1385 757
MartinJohnson 0:404f5a4f1385 758
MartinJohnson 0:404f5a4f1385 759 /* Initialization and Configuration functions *********************************/
MartinJohnson 0:404f5a4f1385 760 ErrorStatus RTC_Init(RTC_InitTypeDef* RTC_InitStruct);
MartinJohnson 0:404f5a4f1385 761 void RTC_StructInit(RTC_InitTypeDef* RTC_InitStruct);
MartinJohnson 0:404f5a4f1385 762 void RTC_WriteProtectionCmd(FunctionalState NewState);
MartinJohnson 0:404f5a4f1385 763 ErrorStatus RTC_EnterInitMode(void);
MartinJohnson 0:404f5a4f1385 764 void RTC_ExitInitMode(void);
MartinJohnson 0:404f5a4f1385 765 ErrorStatus RTC_WaitForSynchro(void);
MartinJohnson 0:404f5a4f1385 766 ErrorStatus RTC_RefClockCmd(FunctionalState NewState);
MartinJohnson 0:404f5a4f1385 767 void RTC_BypassShadowCmd(FunctionalState NewState);
MartinJohnson 0:404f5a4f1385 768
MartinJohnson 0:404f5a4f1385 769 /* Time and Date configuration functions **************************************/
MartinJohnson 0:404f5a4f1385 770 ErrorStatus RTC_SetTime(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct);
MartinJohnson 0:404f5a4f1385 771 void RTC_TimeStructInit(RTC_TimeTypeDef* RTC_TimeStruct);
MartinJohnson 0:404f5a4f1385 772 void RTC_GetTime(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct);
MartinJohnson 0:404f5a4f1385 773 uint32_t RTC_GetSubSecond(void);
MartinJohnson 0:404f5a4f1385 774 ErrorStatus RTC_SetDate(uint32_t RTC_Format, RTC_DateTypeDef* RTC_DateStruct);
MartinJohnson 0:404f5a4f1385 775 void RTC_DateStructInit(RTC_DateTypeDef* RTC_DateStruct);
MartinJohnson 0:404f5a4f1385 776 void RTC_GetDate(uint32_t RTC_Format, RTC_DateTypeDef* RTC_DateStruct);
MartinJohnson 0:404f5a4f1385 777
MartinJohnson 0:404f5a4f1385 778 /* Alarms (Alarm A and Alarm B) configuration functions **********************/
MartinJohnson 0:404f5a4f1385 779 void RTC_SetAlarm(uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef* RTC_AlarmStruct);
MartinJohnson 0:404f5a4f1385 780 void RTC_AlarmStructInit(RTC_AlarmTypeDef* RTC_AlarmStruct);
MartinJohnson 0:404f5a4f1385 781 void RTC_GetAlarm(uint32_t RTC_Format, uint32_t RTC_Alarm, RTC_AlarmTypeDef* RTC_AlarmStruct);
MartinJohnson 0:404f5a4f1385 782 ErrorStatus RTC_AlarmCmd(uint32_t RTC_Alarm, FunctionalState NewState);
MartinJohnson 0:404f5a4f1385 783 void RTC_AlarmSubSecondConfig(uint32_t RTC_Alarm, uint32_t RTC_AlarmSubSecondValue, uint32_t RTC_AlarmSubSecondMask);
MartinJohnson 0:404f5a4f1385 784 uint32_t RTC_GetAlarmSubSecond(uint32_t RTC_Alarm);
MartinJohnson 0:404f5a4f1385 785
MartinJohnson 0:404f5a4f1385 786 /* WakeUp Timer configuration functions ***************************************/
MartinJohnson 0:404f5a4f1385 787 void RTC_WakeUpClockConfig(uint32_t RTC_WakeUpClock);
MartinJohnson 0:404f5a4f1385 788 void RTC_SetWakeUpCounter(uint32_t RTC_WakeUpCounter);
MartinJohnson 0:404f5a4f1385 789 uint32_t RTC_GetWakeUpCounter(void);
MartinJohnson 0:404f5a4f1385 790 ErrorStatus RTC_WakeUpCmd(FunctionalState NewState);
MartinJohnson 0:404f5a4f1385 791
MartinJohnson 0:404f5a4f1385 792 /* Daylight Saving configuration functions ************************************/
MartinJohnson 0:404f5a4f1385 793 void RTC_DayLightSavingConfig(uint32_t RTC_DayLightSaving, uint32_t RTC_StoreOperation);
MartinJohnson 0:404f5a4f1385 794 uint32_t RTC_GetStoreOperation(void);
MartinJohnson 0:404f5a4f1385 795
MartinJohnson 0:404f5a4f1385 796 /* Output pin Configuration function ******************************************/
MartinJohnson 0:404f5a4f1385 797 void RTC_OutputConfig(uint32_t RTC_Output, uint32_t RTC_OutputPolarity);
MartinJohnson 0:404f5a4f1385 798
MartinJohnson 0:404f5a4f1385 799 /* Digital Calibration configuration functions ********************************/
MartinJohnson 0:404f5a4f1385 800 void RTC_CalibOutputCmd(FunctionalState NewState);
MartinJohnson 0:404f5a4f1385 801 void RTC_CalibOutputConfig(uint32_t RTC_CalibOutput);
MartinJohnson 0:404f5a4f1385 802 ErrorStatus RTC_SmoothCalibConfig(uint32_t RTC_SmoothCalibPeriod,
MartinJohnson 0:404f5a4f1385 803 uint32_t RTC_SmoothCalibPlusPulses,
MartinJohnson 0:404f5a4f1385 804 uint32_t RTC_SmouthCalibMinusPulsesValue);
MartinJohnson 0:404f5a4f1385 805
MartinJohnson 0:404f5a4f1385 806 /* TimeStamp configuration functions ******************************************/
MartinJohnson 0:404f5a4f1385 807 void RTC_TimeStampCmd(uint32_t RTC_TimeStampEdge, FunctionalState NewState);
MartinJohnson 0:404f5a4f1385 808 void RTC_GetTimeStamp(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_StampTimeStruct,
MartinJohnson 0:404f5a4f1385 809 RTC_DateTypeDef* RTC_StampDateStruct);
MartinJohnson 0:404f5a4f1385 810 uint32_t RTC_GetTimeStampSubSecond(void);
MartinJohnson 0:404f5a4f1385 811
MartinJohnson 0:404f5a4f1385 812 /* Tampers configuration functions ********************************************/
MartinJohnson 0:404f5a4f1385 813 void RTC_TamperTriggerConfig(uint32_t RTC_Tamper, uint32_t RTC_TamperTrigger);
MartinJohnson 0:404f5a4f1385 814 void RTC_TamperCmd(uint32_t RTC_Tamper, FunctionalState NewState);
MartinJohnson 0:404f5a4f1385 815 void RTC_TamperFilterConfig(uint32_t RTC_TamperFilter);
MartinJohnson 0:404f5a4f1385 816 void RTC_TamperSamplingFreqConfig(uint32_t RTC_TamperSamplingFreq);
MartinJohnson 0:404f5a4f1385 817 void RTC_TamperPinsPrechargeDuration(uint32_t RTC_TamperPrechargeDuration);
MartinJohnson 0:404f5a4f1385 818 void RTC_TimeStampOnTamperDetectionCmd(FunctionalState NewState);
MartinJohnson 0:404f5a4f1385 819 void RTC_TamperPullUpCmd(FunctionalState NewState);
MartinJohnson 0:404f5a4f1385 820
MartinJohnson 0:404f5a4f1385 821 /* Backup Data Registers configuration functions ******************************/
MartinJohnson 0:404f5a4f1385 822 void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data);
MartinJohnson 0:404f5a4f1385 823 uint32_t RTC_ReadBackupRegister(uint32_t RTC_BKP_DR);
MartinJohnson 0:404f5a4f1385 824
MartinJohnson 0:404f5a4f1385 825 /* Output Type Config configuration functions *********************************/
MartinJohnson 0:404f5a4f1385 826 void RTC_OutputTypeConfig(uint32_t RTC_OutputType);
MartinJohnson 0:404f5a4f1385 827
MartinJohnson 0:404f5a4f1385 828 /* RTC_Shift_control_synchonisation_functions *********************************/
MartinJohnson 0:404f5a4f1385 829 ErrorStatus RTC_SynchroShiftConfig(uint32_t RTC_ShiftAdd1S, uint32_t RTC_ShiftSubFS);
MartinJohnson 0:404f5a4f1385 830
MartinJohnson 0:404f5a4f1385 831 /* Interrupts and flags management functions **********************************/
MartinJohnson 0:404f5a4f1385 832 void RTC_ITConfig(uint32_t RTC_IT, FunctionalState NewState);
MartinJohnson 0:404f5a4f1385 833 FlagStatus RTC_GetFlagStatus(uint32_t RTC_FLAG);
MartinJohnson 0:404f5a4f1385 834 void RTC_ClearFlag(uint32_t RTC_FLAG);
MartinJohnson 0:404f5a4f1385 835 ITStatus RTC_GetITStatus(uint32_t RTC_IT);
MartinJohnson 0:404f5a4f1385 836 void RTC_ClearITPendingBit(uint32_t RTC_IT);
MartinJohnson 0:404f5a4f1385 837
MartinJohnson 0:404f5a4f1385 838 #ifdef __cplusplus
MartinJohnson 0:404f5a4f1385 839 }
MartinJohnson 0:404f5a4f1385 840 #endif
MartinJohnson 0:404f5a4f1385 841
MartinJohnson 0:404f5a4f1385 842 #endif /*__STM32F30x_RTC_H */
MartinJohnson 0:404f5a4f1385 843
MartinJohnson 0:404f5a4f1385 844 /**
MartinJohnson 0:404f5a4f1385 845 * @}
MartinJohnson 0:404f5a4f1385 846 */
MartinJohnson 0:404f5a4f1385 847
MartinJohnson 0:404f5a4f1385 848 /**
MartinJohnson 0:404f5a4f1385 849 * @}
MartinJohnson 0:404f5a4f1385 850 */
MartinJohnson 0:404f5a4f1385 851
MartinJohnson 0:404f5a4f1385 852 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/