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