TUKS MCU Introductory course / TUKS-COURSE-TIMER
Committer:
elmot
Date:
Sat Feb 25 00:23:53 2017 +0000
Revision:
2:5acdd8565d02
Parent:
1:d0dfbce63a89
Ready to show

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elmot 1:d0dfbce63a89 1 /**
elmot 1:d0dfbce63a89 2 ******************************************************************************
elmot 1:d0dfbce63a89 3 * @file stm32l4xx_hal_rtc.h
elmot 1:d0dfbce63a89 4 * @author MCD Application Team
elmot 1:d0dfbce63a89 5 * @version V1.5.1
elmot 1:d0dfbce63a89 6 * @date 31-May-2016
elmot 1:d0dfbce63a89 7 * @brief Header file of RTC HAL module.
elmot 1:d0dfbce63a89 8 ******************************************************************************
elmot 1:d0dfbce63a89 9 * @attention
elmot 1:d0dfbce63a89 10 *
elmot 1:d0dfbce63a89 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
elmot 1:d0dfbce63a89 12 *
elmot 1:d0dfbce63a89 13 * Redistribution and use in source and binary forms, with or without modification,
elmot 1:d0dfbce63a89 14 * are permitted provided that the following conditions are met:
elmot 1:d0dfbce63a89 15 * 1. Redistributions of source code must retain the above copyright notice,
elmot 1:d0dfbce63a89 16 * this list of conditions and the following disclaimer.
elmot 1:d0dfbce63a89 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
elmot 1:d0dfbce63a89 18 * this list of conditions and the following disclaimer in the documentation
elmot 1:d0dfbce63a89 19 * and/or other materials provided with the distribution.
elmot 1:d0dfbce63a89 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
elmot 1:d0dfbce63a89 21 * may be used to endorse or promote products derived from this software
elmot 1:d0dfbce63a89 22 * without specific prior written permission.
elmot 1:d0dfbce63a89 23 *
elmot 1:d0dfbce63a89 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
elmot 1:d0dfbce63a89 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
elmot 1:d0dfbce63a89 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
elmot 1:d0dfbce63a89 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
elmot 1:d0dfbce63a89 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
elmot 1:d0dfbce63a89 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
elmot 1:d0dfbce63a89 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
elmot 1:d0dfbce63a89 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
elmot 1:d0dfbce63a89 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
elmot 1:d0dfbce63a89 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
elmot 1:d0dfbce63a89 34 *
elmot 1:d0dfbce63a89 35 ******************************************************************************
elmot 1:d0dfbce63a89 36 */
elmot 1:d0dfbce63a89 37
elmot 1:d0dfbce63a89 38 /* Define to prevent recursive inclusion -------------------------------------*/
elmot 1:d0dfbce63a89 39 #ifndef __STM32L4xx_HAL_RTC_H
elmot 1:d0dfbce63a89 40 #define __STM32L4xx_HAL_RTC_H
elmot 1:d0dfbce63a89 41
elmot 1:d0dfbce63a89 42 #ifdef __cplusplus
elmot 1:d0dfbce63a89 43 extern "C" {
elmot 1:d0dfbce63a89 44 #endif
elmot 1:d0dfbce63a89 45
elmot 1:d0dfbce63a89 46 /* Includes ------------------------------------------------------------------*/
elmot 1:d0dfbce63a89 47 #include "stm32l4xx_hal_def.h"
elmot 1:d0dfbce63a89 48
elmot 1:d0dfbce63a89 49 /** @addtogroup STM32L4xx_HAL_Driver
elmot 1:d0dfbce63a89 50 * @{
elmot 1:d0dfbce63a89 51 */
elmot 1:d0dfbce63a89 52
elmot 1:d0dfbce63a89 53 /** @addtogroup RTC
elmot 1:d0dfbce63a89 54 * @{
elmot 1:d0dfbce63a89 55 */
elmot 1:d0dfbce63a89 56
elmot 1:d0dfbce63a89 57 /* Exported types ------------------------------------------------------------*/
elmot 1:d0dfbce63a89 58 /** @defgroup RTC_Exported_Types RTC Exported Types
elmot 1:d0dfbce63a89 59 * @{
elmot 1:d0dfbce63a89 60 */
elmot 1:d0dfbce63a89 61 /**
elmot 1:d0dfbce63a89 62 * @brief HAL State structures definition
elmot 1:d0dfbce63a89 63 */
elmot 1:d0dfbce63a89 64 typedef enum
elmot 1:d0dfbce63a89 65 {
elmot 1:d0dfbce63a89 66 HAL_RTC_STATE_RESET = 0x00, /*!< RTC not yet initialized or disabled */
elmot 1:d0dfbce63a89 67 HAL_RTC_STATE_READY = 0x01, /*!< RTC initialized and ready for use */
elmot 1:d0dfbce63a89 68 HAL_RTC_STATE_BUSY = 0x02, /*!< RTC process is ongoing */
elmot 1:d0dfbce63a89 69 HAL_RTC_STATE_TIMEOUT = 0x03, /*!< RTC timeout state */
elmot 1:d0dfbce63a89 70 HAL_RTC_STATE_ERROR = 0x04 /*!< RTC error state */
elmot 1:d0dfbce63a89 71
elmot 1:d0dfbce63a89 72 }HAL_RTCStateTypeDef;
elmot 1:d0dfbce63a89 73
elmot 1:d0dfbce63a89 74 /**
elmot 1:d0dfbce63a89 75 * @brief RTC Configuration Structure definition
elmot 1:d0dfbce63a89 76 */
elmot 1:d0dfbce63a89 77 typedef struct
elmot 1:d0dfbce63a89 78 {
elmot 1:d0dfbce63a89 79 uint32_t HourFormat; /*!< Specifies the RTC Hour Format.
elmot 1:d0dfbce63a89 80 This parameter can be a value of @ref RTC_Hour_Formats */
elmot 1:d0dfbce63a89 81
elmot 1:d0dfbce63a89 82 uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value.
elmot 1:d0dfbce63a89 83 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F */
elmot 1:d0dfbce63a89 84
elmot 1:d0dfbce63a89 85 uint32_t SynchPrediv; /*!< Specifies the RTC Synchronous Predivider value.
elmot 1:d0dfbce63a89 86 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7FFF */
elmot 1:d0dfbce63a89 87
elmot 1:d0dfbce63a89 88 uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC output.
elmot 1:d0dfbce63a89 89 This parameter can be a value of @ref RTCEx_Output_selection_Definitions */
elmot 1:d0dfbce63a89 90
elmot 1:d0dfbce63a89 91 uint32_t OutPutRemap; /*!< Specifies the remap for RTC output.
elmot 1:d0dfbce63a89 92 This parameter can be a value of @ref RTC_Output_ALARM_OUT_Remap */
elmot 1:d0dfbce63a89 93
elmot 1:d0dfbce63a89 94 uint32_t OutPutPolarity; /*!< Specifies the polarity of the output signal.
elmot 1:d0dfbce63a89 95 This parameter can be a value of @ref RTC_Output_Polarity_Definitions */
elmot 1:d0dfbce63a89 96
elmot 1:d0dfbce63a89 97 uint32_t OutPutType; /*!< Specifies the RTC Output Pin mode.
elmot 1:d0dfbce63a89 98 This parameter can be a value of @ref RTC_Output_Type_ALARM_OUT */
elmot 1:d0dfbce63a89 99 }RTC_InitTypeDef;
elmot 1:d0dfbce63a89 100
elmot 1:d0dfbce63a89 101 /**
elmot 1:d0dfbce63a89 102 * @brief RTC Time structure definition
elmot 1:d0dfbce63a89 103 */
elmot 1:d0dfbce63a89 104 typedef struct
elmot 1:d0dfbce63a89 105 {
elmot 1:d0dfbce63a89 106 uint8_t Hours; /*!< Specifies the RTC Time Hour.
elmot 1:d0dfbce63a89 107 This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the RTC_HourFormat_12 is selected.
elmot 1:d0dfbce63a89 108 This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the RTC_HourFormat_24 is selected */
elmot 1:d0dfbce63a89 109
elmot 1:d0dfbce63a89 110 uint8_t Minutes; /*!< Specifies the RTC Time Minutes.
elmot 1:d0dfbce63a89 111 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
elmot 1:d0dfbce63a89 112
elmot 1:d0dfbce63a89 113 uint8_t Seconds; /*!< Specifies the RTC Time Seconds.
elmot 1:d0dfbce63a89 114 This parameter must be a number between Min_Data = 0 and Max_Data = 59 */
elmot 1:d0dfbce63a89 115
elmot 1:d0dfbce63a89 116 uint8_t TimeFormat; /*!< Specifies the RTC AM/PM Time.
elmot 1:d0dfbce63a89 117 This parameter can be a value of @ref RTC_AM_PM_Definitions */
elmot 1:d0dfbce63a89 118
elmot 1:d0dfbce63a89 119 uint32_t SubSeconds; /*!< Specifies the RTC_SSR RTC Sub Second register content.
elmot 1:d0dfbce63a89 120 This parameter corresponds to a time unit range between [0-1] Second
elmot 1:d0dfbce63a89 121 with [1 Sec / SecondFraction +1] granularity */
elmot 1:d0dfbce63a89 122
elmot 1:d0dfbce63a89 123 uint32_t SecondFraction; /*!< Specifies the range or granularity of Sub Second register content
elmot 1:d0dfbce63a89 124 corresponding to Synchronous pre-scaler factor value (PREDIV_S)
elmot 1:d0dfbce63a89 125 This parameter corresponds to a time unit range between [0-1] Second
elmot 1:d0dfbce63a89 126 with [1 Sec / SecondFraction +1] granularity.
elmot 1:d0dfbce63a89 127 This field will be used only by HAL_RTC_GetTime function */
elmot 1:d0dfbce63a89 128
elmot 1:d0dfbce63a89 129 uint32_t DayLightSaving; /*!< Specifies RTC_DayLightSaveOperation: the value of hour adjustment.
elmot 1:d0dfbce63a89 130 This parameter can be a value of @ref RTC_DayLightSaving_Definitions */
elmot 1:d0dfbce63a89 131
elmot 1:d0dfbce63a89 132 uint32_t StoreOperation; /*!< Specifies RTC_StoreOperation value to be written in the BCK bit
elmot 1:d0dfbce63a89 133 in CR register to store the operation.
elmot 1:d0dfbce63a89 134 This parameter can be a value of @ref RTC_StoreOperation_Definitions */
elmot 1:d0dfbce63a89 135 }RTC_TimeTypeDef;
elmot 1:d0dfbce63a89 136
elmot 1:d0dfbce63a89 137 /**
elmot 1:d0dfbce63a89 138 * @brief RTC Date structure definition
elmot 1:d0dfbce63a89 139 */
elmot 1:d0dfbce63a89 140 typedef struct
elmot 1:d0dfbce63a89 141 {
elmot 1:d0dfbce63a89 142 uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay.
elmot 1:d0dfbce63a89 143 This parameter can be a value of @ref RTC_WeekDay_Definitions */
elmot 1:d0dfbce63a89 144
elmot 1:d0dfbce63a89 145 uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format).
elmot 1:d0dfbce63a89 146 This parameter can be a value of @ref RTC_Month_Date_Definitions */
elmot 1:d0dfbce63a89 147
elmot 1:d0dfbce63a89 148 uint8_t Date; /*!< Specifies the RTC Date.
elmot 1:d0dfbce63a89 149 This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
elmot 1:d0dfbce63a89 150
elmot 1:d0dfbce63a89 151 uint8_t Year; /*!< Specifies the RTC Date Year.
elmot 1:d0dfbce63a89 152 This parameter must be a number between Min_Data = 0 and Max_Data = 99 */
elmot 1:d0dfbce63a89 153
elmot 1:d0dfbce63a89 154 }RTC_DateTypeDef;
elmot 1:d0dfbce63a89 155
elmot 1:d0dfbce63a89 156 /**
elmot 1:d0dfbce63a89 157 * @brief RTC Alarm structure definition
elmot 1:d0dfbce63a89 158 */
elmot 1:d0dfbce63a89 159 typedef struct
elmot 1:d0dfbce63a89 160 {
elmot 1:d0dfbce63a89 161 RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */
elmot 1:d0dfbce63a89 162
elmot 1:d0dfbce63a89 163 uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks.
elmot 1:d0dfbce63a89 164 This parameter can be a value of @ref RTC_AlarmMask_Definitions */
elmot 1:d0dfbce63a89 165
elmot 1:d0dfbce63a89 166 uint32_t AlarmSubSecondMask; /*!< Specifies the RTC Alarm SubSeconds Masks.
elmot 1:d0dfbce63a89 167 This parameter can be a value of @ref RTC_Alarm_Sub_Seconds_Masks_Definitions */
elmot 1:d0dfbce63a89 168
elmot 1:d0dfbce63a89 169 uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on Date or WeekDay.
elmot 1:d0dfbce63a89 170 This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */
elmot 1:d0dfbce63a89 171
elmot 1:d0dfbce63a89 172 uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Date/WeekDay.
elmot 1:d0dfbce63a89 173 If the Alarm Date is selected, this parameter must be set to a value in the 1-31 range.
elmot 1:d0dfbce63a89 174 If the Alarm WeekDay is selected, this parameter can be a value of @ref RTC_WeekDay_Definitions */
elmot 1:d0dfbce63a89 175
elmot 1:d0dfbce63a89 176 uint32_t Alarm; /*!< Specifies the alarm .
elmot 1:d0dfbce63a89 177 This parameter can be a value of @ref RTC_Alarms_Definitions */
elmot 1:d0dfbce63a89 178 }RTC_AlarmTypeDef;
elmot 1:d0dfbce63a89 179
elmot 1:d0dfbce63a89 180 /**
elmot 1:d0dfbce63a89 181 * @brief Time Handle Structure definition
elmot 1:d0dfbce63a89 182 */
elmot 1:d0dfbce63a89 183 typedef struct
elmot 1:d0dfbce63a89 184 {
elmot 1:d0dfbce63a89 185 RTC_TypeDef *Instance; /*!< Register base address */
elmot 1:d0dfbce63a89 186
elmot 1:d0dfbce63a89 187 RTC_InitTypeDef Init; /*!< RTC required parameters */
elmot 1:d0dfbce63a89 188
elmot 1:d0dfbce63a89 189 HAL_LockTypeDef Lock; /*!< RTC locking object */
elmot 1:d0dfbce63a89 190
elmot 1:d0dfbce63a89 191 __IO HAL_RTCStateTypeDef State; /*!< Time communication state */
elmot 1:d0dfbce63a89 192
elmot 1:d0dfbce63a89 193 }RTC_HandleTypeDef;
elmot 1:d0dfbce63a89 194
elmot 1:d0dfbce63a89 195 /**
elmot 1:d0dfbce63a89 196 * @}
elmot 1:d0dfbce63a89 197 */
elmot 1:d0dfbce63a89 198
elmot 1:d0dfbce63a89 199 /* Exported constants --------------------------------------------------------*/
elmot 1:d0dfbce63a89 200 /** @defgroup RTC_Exported_Constants RTC Exported Constants
elmot 1:d0dfbce63a89 201 * @{
elmot 1:d0dfbce63a89 202 */
elmot 1:d0dfbce63a89 203
elmot 1:d0dfbce63a89 204 /** @defgroup RTC_Hour_Formats RTC Hour Formats
elmot 1:d0dfbce63a89 205 * @{
elmot 1:d0dfbce63a89 206 */
elmot 1:d0dfbce63a89 207 #define RTC_HOURFORMAT_24 ((uint32_t)0x00000000)
elmot 1:d0dfbce63a89 208 #define RTC_HOURFORMAT_12 ((uint32_t)0x00000040)
elmot 1:d0dfbce63a89 209 /**
elmot 1:d0dfbce63a89 210 * @}
elmot 1:d0dfbce63a89 211 */
elmot 1:d0dfbce63a89 212
elmot 1:d0dfbce63a89 213 /** @defgroup RTC_Output_Polarity_Definitions RTC Output Polarity Definitions
elmot 1:d0dfbce63a89 214 * @{
elmot 1:d0dfbce63a89 215 */
elmot 1:d0dfbce63a89 216 #define RTC_OUTPUT_POLARITY_HIGH ((uint32_t)0x00000000)
elmot 1:d0dfbce63a89 217 #define RTC_OUTPUT_POLARITY_LOW ((uint32_t)0x00100000)
elmot 1:d0dfbce63a89 218 /**
elmot 1:d0dfbce63a89 219 * @}
elmot 1:d0dfbce63a89 220 */
elmot 1:d0dfbce63a89 221
elmot 1:d0dfbce63a89 222 /** @defgroup RTC_Output_Type_ALARM_OUT RTC Output Type ALARM OUT
elmot 1:d0dfbce63a89 223 * @{
elmot 1:d0dfbce63a89 224 */
elmot 1:d0dfbce63a89 225 #define RTC_OUTPUT_TYPE_OPENDRAIN ((uint32_t)0x00000000)
elmot 1:d0dfbce63a89 226 #define RTC_OUTPUT_TYPE_PUSHPULL ((uint32_t)RTC_OR_ALARMOUTTYPE)
elmot 1:d0dfbce63a89 227 /**
elmot 1:d0dfbce63a89 228 * @}
elmot 1:d0dfbce63a89 229 */
elmot 1:d0dfbce63a89 230
elmot 1:d0dfbce63a89 231 /** @defgroup RTC_Output_ALARM_OUT_Remap RTC Output ALARM OUT Remap
elmot 1:d0dfbce63a89 232 * @{
elmot 1:d0dfbce63a89 233 */
elmot 1:d0dfbce63a89 234 #define RTC_OUTPUT_REMAP_NONE ((uint32_t)0x00000000)
elmot 1:d0dfbce63a89 235 #define RTC_OUTPUT_REMAP_POS1 ((uint32_t)RTC_OR_OUT_RMP)
elmot 1:d0dfbce63a89 236 /**
elmot 1:d0dfbce63a89 237 * @}
elmot 1:d0dfbce63a89 238 */
elmot 1:d0dfbce63a89 239
elmot 1:d0dfbce63a89 240 /** @defgroup RTC_AM_PM_Definitions RTC AM PM Definitions
elmot 1:d0dfbce63a89 241 * @{
elmot 1:d0dfbce63a89 242 */
elmot 1:d0dfbce63a89 243 #define RTC_HOURFORMAT12_AM ((uint8_t)0x00)
elmot 1:d0dfbce63a89 244 #define RTC_HOURFORMAT12_PM ((uint8_t)0x40)
elmot 1:d0dfbce63a89 245 /**
elmot 1:d0dfbce63a89 246 * @}
elmot 1:d0dfbce63a89 247 */
elmot 1:d0dfbce63a89 248
elmot 1:d0dfbce63a89 249 /** @defgroup RTC_DayLightSaving_Definitions RTC DayLight Saving Definitions
elmot 1:d0dfbce63a89 250 * @{
elmot 1:d0dfbce63a89 251 */
elmot 1:d0dfbce63a89 252 #define RTC_DAYLIGHTSAVING_SUB1H ((uint32_t)0x00020000)
elmot 1:d0dfbce63a89 253 #define RTC_DAYLIGHTSAVING_ADD1H ((uint32_t)0x00010000)
elmot 1:d0dfbce63a89 254 #define RTC_DAYLIGHTSAVING_NONE ((uint32_t)0x00000000)
elmot 1:d0dfbce63a89 255 /**
elmot 1:d0dfbce63a89 256 * @}
elmot 1:d0dfbce63a89 257 */
elmot 1:d0dfbce63a89 258
elmot 1:d0dfbce63a89 259 /** @defgroup RTC_StoreOperation_Definitions RTC Store Operation Definitions
elmot 1:d0dfbce63a89 260 * @{
elmot 1:d0dfbce63a89 261 */
elmot 1:d0dfbce63a89 262 #define RTC_STOREOPERATION_RESET ((uint32_t)0x00000000)
elmot 1:d0dfbce63a89 263 #define RTC_STOREOPERATION_SET ((uint32_t)0x00040000)
elmot 1:d0dfbce63a89 264 /**
elmot 1:d0dfbce63a89 265 * @}
elmot 1:d0dfbce63a89 266 */
elmot 1:d0dfbce63a89 267
elmot 1:d0dfbce63a89 268 /** @defgroup RTC_Input_parameter_format_definitions RTC Input Parameter Format Definitions
elmot 1:d0dfbce63a89 269 * @{
elmot 1:d0dfbce63a89 270 */
elmot 1:d0dfbce63a89 271 #define RTC_FORMAT_BIN ((uint32_t)0x000000000)
elmot 1:d0dfbce63a89 272 #define RTC_FORMAT_BCD ((uint32_t)0x000000001)
elmot 1:d0dfbce63a89 273 /**
elmot 1:d0dfbce63a89 274 * @}
elmot 1:d0dfbce63a89 275 */
elmot 1:d0dfbce63a89 276
elmot 1:d0dfbce63a89 277 /** @defgroup RTC_Month_Date_Definitions RTC Month Date Definitions
elmot 1:d0dfbce63a89 278 * @{
elmot 1:d0dfbce63a89 279 */
elmot 1:d0dfbce63a89 280
elmot 1:d0dfbce63a89 281 /* Coded in BCD format */
elmot 1:d0dfbce63a89 282 #define RTC_MONTH_JANUARY ((uint8_t)0x01)
elmot 1:d0dfbce63a89 283 #define RTC_MONTH_FEBRUARY ((uint8_t)0x02)
elmot 1:d0dfbce63a89 284 #define RTC_MONTH_MARCH ((uint8_t)0x03)
elmot 1:d0dfbce63a89 285 #define RTC_MONTH_APRIL ((uint8_t)0x04)
elmot 1:d0dfbce63a89 286 #define RTC_MONTH_MAY ((uint8_t)0x05)
elmot 1:d0dfbce63a89 287 #define RTC_MONTH_JUNE ((uint8_t)0x06)
elmot 1:d0dfbce63a89 288 #define RTC_MONTH_JULY ((uint8_t)0x07)
elmot 1:d0dfbce63a89 289 #define RTC_MONTH_AUGUST ((uint8_t)0x08)
elmot 1:d0dfbce63a89 290 #define RTC_MONTH_SEPTEMBER ((uint8_t)0x09)
elmot 1:d0dfbce63a89 291 #define RTC_MONTH_OCTOBER ((uint8_t)0x10)
elmot 1:d0dfbce63a89 292 #define RTC_MONTH_NOVEMBER ((uint8_t)0x11)
elmot 1:d0dfbce63a89 293 #define RTC_MONTH_DECEMBER ((uint8_t)0x12)
elmot 1:d0dfbce63a89 294 /**
elmot 1:d0dfbce63a89 295 * @}
elmot 1:d0dfbce63a89 296 */
elmot 1:d0dfbce63a89 297
elmot 1:d0dfbce63a89 298 /** @defgroup RTC_WeekDay_Definitions RTC WeekDay Definitions
elmot 1:d0dfbce63a89 299 * @{
elmot 1:d0dfbce63a89 300 */
elmot 1:d0dfbce63a89 301 #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01)
elmot 1:d0dfbce63a89 302 #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02)
elmot 1:d0dfbce63a89 303 #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03)
elmot 1:d0dfbce63a89 304 #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04)
elmot 1:d0dfbce63a89 305 #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05)
elmot 1:d0dfbce63a89 306 #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06)
elmot 1:d0dfbce63a89 307 #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x07)
elmot 1:d0dfbce63a89 308 /**
elmot 1:d0dfbce63a89 309 * @}
elmot 1:d0dfbce63a89 310 */
elmot 1:d0dfbce63a89 311
elmot 1:d0dfbce63a89 312 /** @defgroup RTC_AlarmDateWeekDay_Definitions RTC Alarm Date WeekDay Definitions
elmot 1:d0dfbce63a89 313 * @{
elmot 1:d0dfbce63a89 314 */
elmot 1:d0dfbce63a89 315 #define RTC_ALARMDATEWEEKDAYSEL_DATE ((uint32_t)0x00000000)
elmot 1:d0dfbce63a89 316 #define RTC_ALARMDATEWEEKDAYSEL_WEEKDAY ((uint32_t)0x40000000)
elmot 1:d0dfbce63a89 317 /**
elmot 1:d0dfbce63a89 318 * @}
elmot 1:d0dfbce63a89 319 */
elmot 1:d0dfbce63a89 320
elmot 1:d0dfbce63a89 321
elmot 1:d0dfbce63a89 322 /** @defgroup RTC_AlarmMask_Definitions RTC Alarm Mask Definitions
elmot 1:d0dfbce63a89 323 * @{
elmot 1:d0dfbce63a89 324 */
elmot 1:d0dfbce63a89 325 #define RTC_ALARMMASK_NONE ((uint32_t)0x00000000)
elmot 1:d0dfbce63a89 326 #define RTC_ALARMMASK_DATEWEEKDAY RTC_ALRMAR_MSK4
elmot 1:d0dfbce63a89 327 #define RTC_ALARMMASK_HOURS RTC_ALRMAR_MSK3
elmot 1:d0dfbce63a89 328 #define RTC_ALARMMASK_MINUTES RTC_ALRMAR_MSK2
elmot 1:d0dfbce63a89 329 #define RTC_ALARMMASK_SECONDS RTC_ALRMAR_MSK1
elmot 1:d0dfbce63a89 330 #define RTC_ALARMMASK_ALL ((uint32_t)0x80808080)
elmot 1:d0dfbce63a89 331 /**
elmot 1:d0dfbce63a89 332 * @}
elmot 1:d0dfbce63a89 333 */
elmot 1:d0dfbce63a89 334
elmot 1:d0dfbce63a89 335 /** @defgroup RTC_Alarms_Definitions RTC Alarms Definitions
elmot 1:d0dfbce63a89 336 * @{
elmot 1:d0dfbce63a89 337 */
elmot 1:d0dfbce63a89 338 #define RTC_ALARM_A RTC_CR_ALRAE
elmot 1:d0dfbce63a89 339 #define RTC_ALARM_B RTC_CR_ALRBE
elmot 1:d0dfbce63a89 340 /**
elmot 1:d0dfbce63a89 341 * @}
elmot 1:d0dfbce63a89 342 */
elmot 1:d0dfbce63a89 343
elmot 1:d0dfbce63a89 344 /** @defgroup RTC_Alarm_Sub_Seconds_Masks_Definitions RTC Alarm Sub Seconds Masks Definitions
elmot 1:d0dfbce63a89 345 * @{
elmot 1:d0dfbce63a89 346 */
elmot 1:d0dfbce63a89 347 #define RTC_ALARMSUBSECONDMASK_ALL ((uint32_t)0x00000000) /*!< All Alarm SS fields are masked.
elmot 1:d0dfbce63a89 348 There is no comparison on sub seconds
elmot 1:d0dfbce63a89 349 for Alarm */
elmot 1:d0dfbce63a89 350 #define RTC_ALARMSUBSECONDMASK_SS14_1 ((uint32_t)0x01000000) /*!< SS[14:1] are don't care in Alarm
elmot 1:d0dfbce63a89 351 comparison. Only SS[0] is compared. */
elmot 1:d0dfbce63a89 352 #define RTC_ALARMSUBSECONDMASK_SS14_2 ((uint32_t)0x02000000) /*!< SS[14:2] are don't care in Alarm
elmot 1:d0dfbce63a89 353 comparison. Only SS[1:0] are compared */
elmot 1:d0dfbce63a89 354 #define RTC_ALARMSUBSECONDMASK_SS14_3 ((uint32_t)0x03000000) /*!< SS[14:3] are don't care in Alarm
elmot 1:d0dfbce63a89 355 comparison. Only SS[2:0] are compared */
elmot 1:d0dfbce63a89 356 #define RTC_ALARMSUBSECONDMASK_SS14_4 ((uint32_t)0x04000000) /*!< SS[14:4] are don't care in Alarm
elmot 1:d0dfbce63a89 357 comparison. Only SS[3:0] are compared */
elmot 1:d0dfbce63a89 358 #define RTC_ALARMSUBSECONDMASK_SS14_5 ((uint32_t)0x05000000) /*!< SS[14:5] are don't care in Alarm
elmot 1:d0dfbce63a89 359 comparison. Only SS[4:0] are compared */
elmot 1:d0dfbce63a89 360 #define RTC_ALARMSUBSECONDMASK_SS14_6 ((uint32_t)0x06000000) /*!< SS[14:6] are don't care in Alarm
elmot 1:d0dfbce63a89 361 comparison. Only SS[5:0] are compared */
elmot 1:d0dfbce63a89 362 #define RTC_ALARMSUBSECONDMASK_SS14_7 ((uint32_t)0x07000000) /*!< SS[14:7] are don't care in Alarm
elmot 1:d0dfbce63a89 363 comparison. Only SS[6:0] are compared */
elmot 1:d0dfbce63a89 364 #define RTC_ALARMSUBSECONDMASK_SS14_8 ((uint32_t)0x08000000) /*!< SS[14:8] are don't care in Alarm
elmot 1:d0dfbce63a89 365 comparison. Only SS[7:0] are compared */
elmot 1:d0dfbce63a89 366 #define RTC_ALARMSUBSECONDMASK_SS14_9 ((uint32_t)0x09000000) /*!< SS[14:9] are don't care in Alarm
elmot 1:d0dfbce63a89 367 comparison. Only SS[8:0] are compared */
elmot 1:d0dfbce63a89 368 #define RTC_ALARMSUBSECONDMASK_SS14_10 ((uint32_t)0x0A000000) /*!< SS[14:10] are don't care in Alarm
elmot 1:d0dfbce63a89 369 comparison. Only SS[9:0] are compared */
elmot 1:d0dfbce63a89 370 #define RTC_ALARMSUBSECONDMASK_SS14_11 ((uint32_t)0x0B000000) /*!< SS[14:11] are don't care in Alarm
elmot 1:d0dfbce63a89 371 comparison. Only SS[10:0] are compared */
elmot 1:d0dfbce63a89 372 #define RTC_ALARMSUBSECONDMASK_SS14_12 ((uint32_t)0x0C000000) /*!< SS[14:12] are don't care in Alarm
elmot 1:d0dfbce63a89 373 comparison. Only SS[11:0] are compared */
elmot 1:d0dfbce63a89 374 #define RTC_ALARMSUBSECONDMASK_SS14_13 ((uint32_t)0x0D000000) /*!< SS[14:13] are don't care in Alarm
elmot 1:d0dfbce63a89 375 comparison. Only SS[12:0] are compared */
elmot 1:d0dfbce63a89 376 #define RTC_ALARMSUBSECONDMASK_SS14 ((uint32_t)0x0E000000) /*!< SS[14] is don't care in Alarm
elmot 1:d0dfbce63a89 377 comparison. Only SS[13:0] are compared */
elmot 1:d0dfbce63a89 378 #define RTC_ALARMSUBSECONDMASK_NONE ((uint32_t)0x0F000000) /*!< SS[14:0] are compared and must match
elmot 1:d0dfbce63a89 379 to activate alarm. */
elmot 1:d0dfbce63a89 380 /**
elmot 1:d0dfbce63a89 381 * @}
elmot 1:d0dfbce63a89 382 */
elmot 1:d0dfbce63a89 383
elmot 1:d0dfbce63a89 384 /** @defgroup RTC_Interrupts_Definitions RTC Interrupts Definitions
elmot 1:d0dfbce63a89 385 * @{
elmot 1:d0dfbce63a89 386 */
elmot 1:d0dfbce63a89 387 #define RTC_IT_TS ((uint32_t)RTC_CR_TSIE) /*!< Enable Timestamp Interrupt */
elmot 1:d0dfbce63a89 388 #define RTC_IT_WUT ((uint32_t)RTC_CR_WUTIE) /*!< Enable Wakeup timer Interrupt */
elmot 1:d0dfbce63a89 389 #define RTC_IT_ALRA ((uint32_t)RTC_CR_ALRAIE) /*!< Enable Alarm A Interrupt */
elmot 1:d0dfbce63a89 390 #define RTC_IT_ALRB ((uint32_t)RTC_CR_ALRBIE) /*!< Enable Alarm B Interrupt */
elmot 1:d0dfbce63a89 391 #define RTC_IT_TAMP ((uint32_t)RTC_TAMPCR_TAMPIE) /*!< Enable all Tamper Interrupt */
elmot 1:d0dfbce63a89 392 #define RTC_IT_TAMP1 ((uint32_t)RTC_TAMPCR_TAMP1IE) /*!< Enable Tamper 1 Interrupt */
elmot 1:d0dfbce63a89 393 #define RTC_IT_TAMP2 ((uint32_t)RTC_TAMPCR_TAMP2IE) /*!< Enable Tamper 2 Interrupt */
elmot 1:d0dfbce63a89 394 #define RTC_IT_TAMP3 ((uint32_t)RTC_TAMPCR_TAMP3IE) /*!< Enable Tamper 3 Interrupt */
elmot 1:d0dfbce63a89 395 /**
elmot 1:d0dfbce63a89 396 * @}
elmot 1:d0dfbce63a89 397 */
elmot 1:d0dfbce63a89 398
elmot 1:d0dfbce63a89 399 /** @defgroup RTC_Flags_Definitions RTC Flags Definitions
elmot 1:d0dfbce63a89 400 * @{
elmot 1:d0dfbce63a89 401 */
elmot 1:d0dfbce63a89 402 #define RTC_FLAG_RECALPF ((uint32_t)RTC_ISR_RECALPF)
elmot 1:d0dfbce63a89 403 #define RTC_FLAG_TAMP3F ((uint32_t)RTC_ISR_TAMP3F)
elmot 1:d0dfbce63a89 404 #define RTC_FLAG_TAMP2F ((uint32_t)RTC_ISR_TAMP2F)
elmot 1:d0dfbce63a89 405 #define RTC_FLAG_TAMP1F ((uint32_t)RTC_ISR_TAMP1F)
elmot 1:d0dfbce63a89 406 #define RTC_FLAG_TSOVF ((uint32_t)RTC_ISR_TSOVF)
elmot 1:d0dfbce63a89 407 #define RTC_FLAG_TSF ((uint32_t)RTC_ISR_TSF)
elmot 1:d0dfbce63a89 408 #define RTC_FLAG_ITSF ((uint32_t)RTC_ISR_ITSF)
elmot 1:d0dfbce63a89 409 #define RTC_FLAG_WUTF ((uint32_t)RTC_ISR_WUTF)
elmot 1:d0dfbce63a89 410 #define RTC_FLAG_ALRBF ((uint32_t)RTC_ISR_ALRBF)
elmot 1:d0dfbce63a89 411 #define RTC_FLAG_ALRAF ((uint32_t)RTC_ISR_ALRAF)
elmot 1:d0dfbce63a89 412 #define RTC_FLAG_INITF ((uint32_t)RTC_ISR_INITF)
elmot 1:d0dfbce63a89 413 #define RTC_FLAG_RSF ((uint32_t)RTC_ISR_RSF)
elmot 1:d0dfbce63a89 414 #define RTC_FLAG_INITS ((uint32_t)RTC_ISR_INITS)
elmot 1:d0dfbce63a89 415 #define RTC_FLAG_SHPF ((uint32_t)RTC_ISR_SHPF)
elmot 1:d0dfbce63a89 416 #define RTC_FLAG_WUTWF ((uint32_t)RTC_ISR_WUTWF)
elmot 1:d0dfbce63a89 417 #define RTC_FLAG_ALRBWF ((uint32_t)RTC_ISR_ALRBWF)
elmot 1:d0dfbce63a89 418 #define RTC_FLAG_ALRAWF ((uint32_t)RTC_ISR_ALRAWF)
elmot 1:d0dfbce63a89 419 /**
elmot 1:d0dfbce63a89 420 * @}
elmot 1:d0dfbce63a89 421 */
elmot 1:d0dfbce63a89 422
elmot 1:d0dfbce63a89 423 /**
elmot 1:d0dfbce63a89 424 * @}
elmot 1:d0dfbce63a89 425 */
elmot 1:d0dfbce63a89 426
elmot 1:d0dfbce63a89 427 /* Exported macros -----------------------------------------------------------*/
elmot 1:d0dfbce63a89 428 /** @defgroup RTC_Exported_Macros RTC Exported Macros
elmot 1:d0dfbce63a89 429 * @{
elmot 1:d0dfbce63a89 430 */
elmot 1:d0dfbce63a89 431
elmot 1:d0dfbce63a89 432 /** @brief Reset RTC handle state.
elmot 1:d0dfbce63a89 433 * @param __HANDLE__: RTC handle.
elmot 1:d0dfbce63a89 434 * @retval None
elmot 1:d0dfbce63a89 435 */
elmot 1:d0dfbce63a89 436 #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET)
elmot 1:d0dfbce63a89 437
elmot 1:d0dfbce63a89 438 /**
elmot 1:d0dfbce63a89 439 * @brief Disable the write protection for RTC registers.
elmot 1:d0dfbce63a89 440 * @param __HANDLE__: specifies the RTC handle.
elmot 1:d0dfbce63a89 441 * @retval None
elmot 1:d0dfbce63a89 442 */
elmot 1:d0dfbce63a89 443 #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) \
elmot 1:d0dfbce63a89 444 do{ \
elmot 1:d0dfbce63a89 445 (__HANDLE__)->Instance->WPR = 0xCA; \
elmot 1:d0dfbce63a89 446 (__HANDLE__)->Instance->WPR = 0x53; \
elmot 1:d0dfbce63a89 447 } while(0)
elmot 1:d0dfbce63a89 448
elmot 1:d0dfbce63a89 449 /**
elmot 1:d0dfbce63a89 450 * @brief Enable the write protection for RTC registers.
elmot 1:d0dfbce63a89 451 * @param __HANDLE__: specifies the RTC handle.
elmot 1:d0dfbce63a89 452 * @retval None
elmot 1:d0dfbce63a89 453 */
elmot 1:d0dfbce63a89 454 #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) \
elmot 1:d0dfbce63a89 455 do{ \
elmot 1:d0dfbce63a89 456 (__HANDLE__)->Instance->WPR = 0xFF; \
elmot 1:d0dfbce63a89 457 } while(0)
elmot 1:d0dfbce63a89 458
elmot 1:d0dfbce63a89 459
elmot 1:d0dfbce63a89 460 /**
elmot 1:d0dfbce63a89 461 * @brief Enable the RTC ALARMA peripheral.
elmot 1:d0dfbce63a89 462 * @param __HANDLE__: specifies the RTC handle.
elmot 1:d0dfbce63a89 463 * @retval None
elmot 1:d0dfbce63a89 464 */
elmot 1:d0dfbce63a89 465 #define __HAL_RTC_ALARMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRAE))
elmot 1:d0dfbce63a89 466
elmot 1:d0dfbce63a89 467 /**
elmot 1:d0dfbce63a89 468 * @brief Disable the RTC ALARMA peripheral.
elmot 1:d0dfbce63a89 469 * @param __HANDLE__: specifies the RTC handle.
elmot 1:d0dfbce63a89 470 * @retval None
elmot 1:d0dfbce63a89 471 */
elmot 1:d0dfbce63a89 472 #define __HAL_RTC_ALARMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRAE))
elmot 1:d0dfbce63a89 473
elmot 1:d0dfbce63a89 474 /**
elmot 1:d0dfbce63a89 475 * @brief Enable the RTC ALARMB peripheral.
elmot 1:d0dfbce63a89 476 * @param __HANDLE__: specifies the RTC handle.
elmot 1:d0dfbce63a89 477 * @retval None
elmot 1:d0dfbce63a89 478 */
elmot 1:d0dfbce63a89 479 #define __HAL_RTC_ALARMB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRBE))
elmot 1:d0dfbce63a89 480
elmot 1:d0dfbce63a89 481 /**
elmot 1:d0dfbce63a89 482 * @brief Disable the RTC ALARMB peripheral.
elmot 1:d0dfbce63a89 483 * @param __HANDLE__: specifies the RTC handle.
elmot 1:d0dfbce63a89 484 * @retval None
elmot 1:d0dfbce63a89 485 */
elmot 1:d0dfbce63a89 486 #define __HAL_RTC_ALARMB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRBE))
elmot 1:d0dfbce63a89 487
elmot 1:d0dfbce63a89 488 /**
elmot 1:d0dfbce63a89 489 * @brief Enable the RTC Alarm interrupt.
elmot 1:d0dfbce63a89 490 * @param __HANDLE__: specifies the RTC handle.
elmot 1:d0dfbce63a89 491 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
elmot 1:d0dfbce63a89 492 * This parameter can be any combination of the following values:
elmot 1:d0dfbce63a89 493 * @arg RTC_IT_ALRA: Alarm A interrupt
elmot 1:d0dfbce63a89 494 * @arg RTC_IT_ALRB: Alarm B interrupt
elmot 1:d0dfbce63a89 495 * @retval None
elmot 1:d0dfbce63a89 496 */
elmot 1:d0dfbce63a89 497 #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
elmot 1:d0dfbce63a89 498
elmot 1:d0dfbce63a89 499 /**
elmot 1:d0dfbce63a89 500 * @brief Disable the RTC Alarm interrupt.
elmot 1:d0dfbce63a89 501 * @param __HANDLE__: specifies the RTC handle.
elmot 1:d0dfbce63a89 502 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled.
elmot 1:d0dfbce63a89 503 * This parameter can be any combination of the following values:
elmot 1:d0dfbce63a89 504 * @arg RTC_IT_ALRA: Alarm A interrupt
elmot 1:d0dfbce63a89 505 * @arg RTC_IT_ALRB: Alarm B interrupt
elmot 1:d0dfbce63a89 506 * @retval None
elmot 1:d0dfbce63a89 507 */
elmot 1:d0dfbce63a89 508 #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
elmot 1:d0dfbce63a89 509
elmot 1:d0dfbce63a89 510 /**
elmot 1:d0dfbce63a89 511 * @brief Check whether the specified RTC Alarm interrupt has occurred or not.
elmot 1:d0dfbce63a89 512 * @param __HANDLE__: specifies the RTC handle.
elmot 1:d0dfbce63a89 513 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check.
elmot 1:d0dfbce63a89 514 * This parameter can be:
elmot 1:d0dfbce63a89 515 * @arg RTC_IT_ALRA: Alarm A interrupt
elmot 1:d0dfbce63a89 516 * @arg RTC_IT_ALRB: Alarm B interrupt
elmot 1:d0dfbce63a89 517 * @retval None
elmot 1:d0dfbce63a89 518 */
elmot 1:d0dfbce63a89 519 #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR)& ((__INTERRUPT__)>> 4)) != RESET) ? SET : RESET)
elmot 1:d0dfbce63a89 520
elmot 1:d0dfbce63a89 521 /**
elmot 1:d0dfbce63a89 522 * @brief Get the selected RTC Alarm's flag status.
elmot 1:d0dfbce63a89 523 * @param __HANDLE__: specifies the RTC handle.
elmot 1:d0dfbce63a89 524 * @param __FLAG__: specifies the RTC Alarm Flag sources to check.
elmot 1:d0dfbce63a89 525 * This parameter can be:
elmot 1:d0dfbce63a89 526 * @arg RTC_FLAG_ALRAF
elmot 1:d0dfbce63a89 527 * @arg RTC_FLAG_ALRBF
elmot 1:d0dfbce63a89 528 * @arg RTC_FLAG_ALRAWF
elmot 1:d0dfbce63a89 529 * @arg RTC_FLAG_ALRBWF
elmot 1:d0dfbce63a89 530 * @retval None
elmot 1:d0dfbce63a89 531 */
elmot 1:d0dfbce63a89 532 #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET) ? SET : RESET)
elmot 1:d0dfbce63a89 533
elmot 1:d0dfbce63a89 534 /**
elmot 1:d0dfbce63a89 535 * @brief Clear the RTC Alarm's pending flags.
elmot 1:d0dfbce63a89 536 * @param __HANDLE__: specifies the RTC handle.
elmot 1:d0dfbce63a89 537 * @param __FLAG__: specifies the RTC Alarm Flag sources to clear.
elmot 1:d0dfbce63a89 538 * This parameter can be:
elmot 1:d0dfbce63a89 539 * @arg RTC_FLAG_ALRAF
elmot 1:d0dfbce63a89 540 * @arg RTC_FLAG_ALRBF
elmot 1:d0dfbce63a89 541 * @retval None
elmot 1:d0dfbce63a89 542 */
elmot 1:d0dfbce63a89 543 #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT))
elmot 1:d0dfbce63a89 544
elmot 1:d0dfbce63a89 545 /**
elmot 1:d0dfbce63a89 546 * @brief Check whether the specified RTC Alarm interrupt is enabled or not.
elmot 1:d0dfbce63a89 547 * @param __HANDLE__: specifies the RTC handle.
elmot 1:d0dfbce63a89 548 * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check.
elmot 1:d0dfbce63a89 549 * This parameter can be:
elmot 1:d0dfbce63a89 550 * @arg RTC_IT_ALRA: Alarm A interrupt
elmot 1:d0dfbce63a89 551 * @arg RTC_IT_ALRB: Alarm B interrupt
elmot 1:d0dfbce63a89 552 * @retval None
elmot 1:d0dfbce63a89 553 */
elmot 1:d0dfbce63a89 554 #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET)
elmot 1:d0dfbce63a89 555
elmot 1:d0dfbce63a89 556 /**
elmot 1:d0dfbce63a89 557 * @brief Enable interrupt on the RTC Alarm associated Exti line.
elmot 1:d0dfbce63a89 558 * @retval None
elmot 1:d0dfbce63a89 559 */
elmot 1:d0dfbce63a89 560 #define __HAL_RTC_ALARM_EXTI_ENABLE_IT() (EXTI->IMR1 |= RTC_EXTI_LINE_ALARM_EVENT)
elmot 1:d0dfbce63a89 561
elmot 1:d0dfbce63a89 562 /**
elmot 1:d0dfbce63a89 563 * @brief Disable interrupt on the RTC Alarm associated Exti line.
elmot 1:d0dfbce63a89 564 * @retval None
elmot 1:d0dfbce63a89 565 */
elmot 1:d0dfbce63a89 566 #define __HAL_RTC_ALARM_EXTI_DISABLE_IT() (EXTI->IMR1 &= ~(RTC_EXTI_LINE_ALARM_EVENT))
elmot 1:d0dfbce63a89 567
elmot 1:d0dfbce63a89 568 /**
elmot 1:d0dfbce63a89 569 * @brief Enable event on the RTC Alarm associated Exti line.
elmot 1:d0dfbce63a89 570 * @retval None
elmot 1:d0dfbce63a89 571 */
elmot 1:d0dfbce63a89 572 #define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() (EXTI->EMR1 |= RTC_EXTI_LINE_ALARM_EVENT)
elmot 1:d0dfbce63a89 573
elmot 1:d0dfbce63a89 574 /**
elmot 1:d0dfbce63a89 575 * @brief Disable event on the RTC Alarm associated Exti line.
elmot 1:d0dfbce63a89 576 * @retval None
elmot 1:d0dfbce63a89 577 */
elmot 1:d0dfbce63a89 578 #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() (EXTI->EMR1 &= ~(RTC_EXTI_LINE_ALARM_EVENT))
elmot 1:d0dfbce63a89 579
elmot 1:d0dfbce63a89 580 /**
elmot 1:d0dfbce63a89 581 * @brief Enable falling edge trigger on the RTC Alarm associated Exti line.
elmot 1:d0dfbce63a89 582 * @retval None
elmot 1:d0dfbce63a89 583 */
elmot 1:d0dfbce63a89 584 #define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR1 |= RTC_EXTI_LINE_ALARM_EVENT)
elmot 1:d0dfbce63a89 585
elmot 1:d0dfbce63a89 586 /**
elmot 1:d0dfbce63a89 587 * @brief Disable falling edge trigger on the RTC Alarm associated Exti line.
elmot 1:d0dfbce63a89 588 * @retval None
elmot 1:d0dfbce63a89 589 */
elmot 1:d0dfbce63a89 590 #define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR1 &= ~(RTC_EXTI_LINE_ALARM_EVENT))
elmot 1:d0dfbce63a89 591
elmot 1:d0dfbce63a89 592 /**
elmot 1:d0dfbce63a89 593 * @brief Enable rising edge trigger on the RTC Alarm associated Exti line.
elmot 1:d0dfbce63a89 594 * @retval None
elmot 1:d0dfbce63a89 595 */
elmot 1:d0dfbce63a89 596 #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR1 |= RTC_EXTI_LINE_ALARM_EVENT)
elmot 1:d0dfbce63a89 597
elmot 1:d0dfbce63a89 598 /**
elmot 1:d0dfbce63a89 599 * @brief Disable rising edge trigger on the RTC Alarm associated Exti line.
elmot 1:d0dfbce63a89 600 * @retval None
elmot 1:d0dfbce63a89 601 */
elmot 1:d0dfbce63a89 602 #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR1 &= ~(RTC_EXTI_LINE_ALARM_EVENT))
elmot 1:d0dfbce63a89 603
elmot 1:d0dfbce63a89 604 /**
elmot 1:d0dfbce63a89 605 * @brief Enable rising & falling edge trigger on the RTC Alarm associated Exti line.
elmot 1:d0dfbce63a89 606 * @retval None
elmot 1:d0dfbce63a89 607 */
elmot 1:d0dfbce63a89 608 #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() do { \
elmot 1:d0dfbce63a89 609 __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE(); \
elmot 1:d0dfbce63a89 610 __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE(); \
elmot 1:d0dfbce63a89 611 } while(0)
elmot 1:d0dfbce63a89 612
elmot 1:d0dfbce63a89 613 /**
elmot 1:d0dfbce63a89 614 * @brief Disable rising & falling edge trigger on the RTC Alarm associated Exti line.
elmot 1:d0dfbce63a89 615 * @retval None
elmot 1:d0dfbce63a89 616 */
elmot 1:d0dfbce63a89 617 #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_FALLING_EDGE() do { \
elmot 1:d0dfbce63a89 618 __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE(); \
elmot 1:d0dfbce63a89 619 __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE(); \
elmot 1:d0dfbce63a89 620 } while(0)
elmot 1:d0dfbce63a89 621
elmot 1:d0dfbce63a89 622 /**
elmot 1:d0dfbce63a89 623 * @brief Check whether the RTC Alarm associated Exti line interrupt flag is set or not.
elmot 1:d0dfbce63a89 624 * @retval Line Status.
elmot 1:d0dfbce63a89 625 */
elmot 1:d0dfbce63a89 626 #define __HAL_RTC_ALARM_EXTI_GET_FLAG() (EXTI->PR1 & RTC_EXTI_LINE_ALARM_EVENT)
elmot 1:d0dfbce63a89 627
elmot 1:d0dfbce63a89 628 /**
elmot 1:d0dfbce63a89 629 * @brief Clear the RTC Alarm associated Exti line flag.
elmot 1:d0dfbce63a89 630 * @retval None
elmot 1:d0dfbce63a89 631 */
elmot 1:d0dfbce63a89 632 #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI->PR1 = RTC_EXTI_LINE_ALARM_EVENT)
elmot 1:d0dfbce63a89 633
elmot 1:d0dfbce63a89 634 /**
elmot 1:d0dfbce63a89 635 * @brief Generate a Software interrupt on RTC Alarm associated Exti line.
elmot 1:d0dfbce63a89 636 * @retval None
elmot 1:d0dfbce63a89 637 */
elmot 1:d0dfbce63a89 638 #define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() (EXTI->SWIER1 |= RTC_EXTI_LINE_ALARM_EVENT)
elmot 1:d0dfbce63a89 639
elmot 1:d0dfbce63a89 640 /**
elmot 1:d0dfbce63a89 641 * @}
elmot 1:d0dfbce63a89 642 */
elmot 1:d0dfbce63a89 643
elmot 1:d0dfbce63a89 644 /* Include RTC HAL Extended module */
elmot 1:d0dfbce63a89 645 #include "stm32l4xx_hal_rtc_ex.h"
elmot 1:d0dfbce63a89 646
elmot 1:d0dfbce63a89 647 /* Exported functions --------------------------------------------------------*/
elmot 1:d0dfbce63a89 648 /** @addtogroup RTC_Exported_Functions
elmot 1:d0dfbce63a89 649 * @{
elmot 1:d0dfbce63a89 650 */
elmot 1:d0dfbce63a89 651
elmot 1:d0dfbce63a89 652 /** @addtogroup RTC_Exported_Functions_Group1
elmot 1:d0dfbce63a89 653 * @{
elmot 1:d0dfbce63a89 654 */
elmot 1:d0dfbce63a89 655 /* Initialization and de-initialization functions ****************************/
elmot 1:d0dfbce63a89 656 HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc);
elmot 1:d0dfbce63a89 657 HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc);
elmot 1:d0dfbce63a89 658 void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc);
elmot 1:d0dfbce63a89 659 void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc);
elmot 1:d0dfbce63a89 660 /**
elmot 1:d0dfbce63a89 661 * @}
elmot 1:d0dfbce63a89 662 */
elmot 1:d0dfbce63a89 663
elmot 1:d0dfbce63a89 664 /** @addtogroup RTC_Exported_Functions_Group2
elmot 1:d0dfbce63a89 665 * @{
elmot 1:d0dfbce63a89 666 */
elmot 1:d0dfbce63a89 667 /* RTC Time and Date functions ************************************************/
elmot 1:d0dfbce63a89 668 HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
elmot 1:d0dfbce63a89 669 HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format);
elmot 1:d0dfbce63a89 670 HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
elmot 1:d0dfbce63a89 671 HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format);
elmot 1:d0dfbce63a89 672 /**
elmot 1:d0dfbce63a89 673 * @}
elmot 1:d0dfbce63a89 674 */
elmot 1:d0dfbce63a89 675
elmot 1:d0dfbce63a89 676 /** @addtogroup RTC_Exported_Functions_Group3
elmot 1:d0dfbce63a89 677 * @{
elmot 1:d0dfbce63a89 678 */
elmot 1:d0dfbce63a89 679 /* RTC Alarm functions ********************************************************/
elmot 1:d0dfbce63a89 680 HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
elmot 1:d0dfbce63a89 681 HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format);
elmot 1:d0dfbce63a89 682 HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm);
elmot 1:d0dfbce63a89 683 HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format);
elmot 1:d0dfbce63a89 684 void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc);
elmot 1:d0dfbce63a89 685 HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout);
elmot 1:d0dfbce63a89 686 void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc);
elmot 1:d0dfbce63a89 687 /**
elmot 1:d0dfbce63a89 688 * @}
elmot 1:d0dfbce63a89 689 */
elmot 1:d0dfbce63a89 690
elmot 1:d0dfbce63a89 691 /** @addtogroup RTC_Exported_Functions_Group4
elmot 1:d0dfbce63a89 692 * @{
elmot 1:d0dfbce63a89 693 */
elmot 1:d0dfbce63a89 694 /* Peripheral Control functions ***********************************************/
elmot 1:d0dfbce63a89 695 HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc);
elmot 1:d0dfbce63a89 696 /**
elmot 1:d0dfbce63a89 697 * @}
elmot 1:d0dfbce63a89 698 */
elmot 1:d0dfbce63a89 699
elmot 1:d0dfbce63a89 700 /** @addtogroup RTC_Exported_Functions_Group5
elmot 1:d0dfbce63a89 701 * @{
elmot 1:d0dfbce63a89 702 */
elmot 1:d0dfbce63a89 703 /* Peripheral State functions *************************************************/
elmot 1:d0dfbce63a89 704 HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc);
elmot 1:d0dfbce63a89 705
elmot 1:d0dfbce63a89 706 /**
elmot 1:d0dfbce63a89 707 * @}
elmot 1:d0dfbce63a89 708 */
elmot 1:d0dfbce63a89 709
elmot 1:d0dfbce63a89 710 /**
elmot 1:d0dfbce63a89 711 * @}
elmot 1:d0dfbce63a89 712 */
elmot 1:d0dfbce63a89 713
elmot 1:d0dfbce63a89 714 /* Private types -------------------------------------------------------------*/
elmot 1:d0dfbce63a89 715 /* Private variables ---------------------------------------------------------*/
elmot 1:d0dfbce63a89 716 /* Private constants ---------------------------------------------------------*/
elmot 1:d0dfbce63a89 717 /** @defgroup RTC_Private_Constants RTC Private Constants
elmot 1:d0dfbce63a89 718 * @{
elmot 1:d0dfbce63a89 719 */
elmot 1:d0dfbce63a89 720 /* Masks Definition */
elmot 1:d0dfbce63a89 721 #define RTC_TR_RESERVED_MASK ((uint32_t)0x007F7F7F)
elmot 1:d0dfbce63a89 722 #define RTC_DR_RESERVED_MASK ((uint32_t)0x00FFFF3F)
elmot 1:d0dfbce63a89 723 #define RTC_INIT_MASK ((uint32_t)0xFFFFFFFFU)
elmot 1:d0dfbce63a89 724 #define RTC_RSF_MASK ((uint32_t)0xFFFFFF5FU)
elmot 1:d0dfbce63a89 725
elmot 1:d0dfbce63a89 726 #define RTC_TIMEOUT_VALUE 1000
elmot 1:d0dfbce63a89 727
elmot 1:d0dfbce63a89 728 #define RTC_EXTI_LINE_ALARM_EVENT ((uint32_t)0x00040000) /*!< External interrupt line 18 Connected to the RTC Alarm event */
elmot 1:d0dfbce63a89 729
elmot 1:d0dfbce63a89 730 /**
elmot 1:d0dfbce63a89 731 * @}
elmot 1:d0dfbce63a89 732 */
elmot 1:d0dfbce63a89 733
elmot 1:d0dfbce63a89 734 /* Private macros ------------------------------------------------------------*/
elmot 1:d0dfbce63a89 735 /** @defgroup RTC_Private_Macros RTC Private Macros
elmot 1:d0dfbce63a89 736 * @{
elmot 1:d0dfbce63a89 737 */
elmot 1:d0dfbce63a89 738
elmot 1:d0dfbce63a89 739 /** @defgroup RTC_IS_RTC_Definitions RTC Private macros to check input parameters
elmot 1:d0dfbce63a89 740 * @{
elmot 1:d0dfbce63a89 741 */
elmot 1:d0dfbce63a89 742
elmot 1:d0dfbce63a89 743 #define IS_RTC_HOUR_FORMAT(FORMAT) (((FORMAT) == RTC_HOURFORMAT_12) || \
elmot 1:d0dfbce63a89 744 ((FORMAT) == RTC_HOURFORMAT_24))
elmot 1:d0dfbce63a89 745
elmot 1:d0dfbce63a89 746 #define IS_RTC_OUTPUT_POL(POL) (((POL) == RTC_OUTPUT_POLARITY_HIGH) || \
elmot 1:d0dfbce63a89 747 ((POL) == RTC_OUTPUT_POLARITY_LOW))
elmot 1:d0dfbce63a89 748
elmot 1:d0dfbce63a89 749 #define IS_RTC_OUTPUT_TYPE(TYPE) (((TYPE) == RTC_OUTPUT_TYPE_OPENDRAIN) || \
elmot 1:d0dfbce63a89 750 ((TYPE) == RTC_OUTPUT_TYPE_PUSHPULL))
elmot 1:d0dfbce63a89 751
elmot 1:d0dfbce63a89 752 #define IS_RTC_OUTPUT_REMAP(REMAP) (((REMAP) == RTC_OUTPUT_REMAP_NONE) || \
elmot 1:d0dfbce63a89 753 ((REMAP) == RTC_OUTPUT_REMAP_POS1))
elmot 1:d0dfbce63a89 754
elmot 1:d0dfbce63a89 755 #define IS_RTC_HOURFORMAT12(PM) (((PM) == RTC_HOURFORMAT12_AM) || ((PM) == RTC_HOURFORMAT12_PM))
elmot 1:d0dfbce63a89 756
elmot 1:d0dfbce63a89 757 #define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DAYLIGHTSAVING_SUB1H) || \
elmot 1:d0dfbce63a89 758 ((SAVE) == RTC_DAYLIGHTSAVING_ADD1H) || \
elmot 1:d0dfbce63a89 759 ((SAVE) == RTC_DAYLIGHTSAVING_NONE))
elmot 1:d0dfbce63a89 760
elmot 1:d0dfbce63a89 761 #define IS_RTC_STORE_OPERATION(OPERATION) (((OPERATION) == RTC_STOREOPERATION_RESET) || \
elmot 1:d0dfbce63a89 762 ((OPERATION) == RTC_STOREOPERATION_SET))
elmot 1:d0dfbce63a89 763
elmot 1:d0dfbce63a89 764 #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD))
elmot 1:d0dfbce63a89 765
elmot 1:d0dfbce63a89 766 #define IS_RTC_YEAR(YEAR) ((YEAR) <= (uint32_t)99)
elmot 1:d0dfbce63a89 767
elmot 1:d0dfbce63a89 768 #define IS_RTC_MONTH(MONTH) (((MONTH) >= (uint32_t)1) && ((MONTH) <= (uint32_t)12))
elmot 1:d0dfbce63a89 769
elmot 1:d0dfbce63a89 770 #define IS_RTC_DATE(DATE) (((DATE) >= (uint32_t)1) && ((DATE) <= (uint32_t)31))
elmot 1:d0dfbce63a89 771
elmot 1:d0dfbce63a89 772 #define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \
elmot 1:d0dfbce63a89 773 ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \
elmot 1:d0dfbce63a89 774 ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \
elmot 1:d0dfbce63a89 775 ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \
elmot 1:d0dfbce63a89 776 ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \
elmot 1:d0dfbce63a89 777 ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \
elmot 1:d0dfbce63a89 778 ((WEEKDAY) == RTC_WEEKDAY_SUNDAY))
elmot 1:d0dfbce63a89 779
elmot 1:d0dfbce63a89 780 #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) >(uint32_t) 0) && ((DATE) <= (uint32_t)31))
elmot 1:d0dfbce63a89 781
elmot 1:d0dfbce63a89 782 #define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \
elmot 1:d0dfbce63a89 783 ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \
elmot 1:d0dfbce63a89 784 ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \
elmot 1:d0dfbce63a89 785 ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \
elmot 1:d0dfbce63a89 786 ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \
elmot 1:d0dfbce63a89 787 ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \
elmot 1:d0dfbce63a89 788 ((WEEKDAY) == RTC_WEEKDAY_SUNDAY))
elmot 1:d0dfbce63a89 789
elmot 1:d0dfbce63a89 790 #define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL) (((SEL) == RTC_ALARMDATEWEEKDAYSEL_DATE) || \
elmot 1:d0dfbce63a89 791 ((SEL) == RTC_ALARMDATEWEEKDAYSEL_WEEKDAY))
elmot 1:d0dfbce63a89 792
elmot 1:d0dfbce63a89 793 #define IS_RTC_ALARM_MASK(MASK) (((MASK) & 0x7F7F7F7F) == (uint32_t)RESET)
elmot 1:d0dfbce63a89 794
elmot 1:d0dfbce63a89 795 #define IS_RTC_ALARM(ALARM) (((ALARM) == RTC_ALARM_A) || ((ALARM) == RTC_ALARM_B))
elmot 1:d0dfbce63a89 796
elmot 1:d0dfbce63a89 797 #define IS_RTC_ALARM_SUB_SECOND_VALUE(VALUE) ((VALUE) <= (uint32_t)0x00007FFF)
elmot 1:d0dfbce63a89 798
elmot 1:d0dfbce63a89 799 #define IS_RTC_ALARM_SUB_SECOND_MASK(MASK) (((MASK) == RTC_ALARMSUBSECONDMASK_ALL) || \
elmot 1:d0dfbce63a89 800 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_1) || \
elmot 1:d0dfbce63a89 801 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_2) || \
elmot 1:d0dfbce63a89 802 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_3) || \
elmot 1:d0dfbce63a89 803 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_4) || \
elmot 1:d0dfbce63a89 804 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_5) || \
elmot 1:d0dfbce63a89 805 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_6) || \
elmot 1:d0dfbce63a89 806 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_7) || \
elmot 1:d0dfbce63a89 807 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_8) || \
elmot 1:d0dfbce63a89 808 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_9) || \
elmot 1:d0dfbce63a89 809 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_10) || \
elmot 1:d0dfbce63a89 810 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_11) || \
elmot 1:d0dfbce63a89 811 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_12) || \
elmot 1:d0dfbce63a89 812 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14_13) || \
elmot 1:d0dfbce63a89 813 ((MASK) == RTC_ALARMSUBSECONDMASK_SS14) || \
elmot 1:d0dfbce63a89 814 ((MASK) == RTC_ALARMSUBSECONDMASK_NONE))
elmot 1:d0dfbce63a89 815
elmot 1:d0dfbce63a89 816 #define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= (uint32_t)0x7F)
elmot 1:d0dfbce63a89 817
elmot 1:d0dfbce63a89 818 #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= (uint32_t)0x7FFF)
elmot 1:d0dfbce63a89 819
elmot 1:d0dfbce63a89 820 #define IS_RTC_HOUR12(HOUR) (((HOUR) > (uint32_t)0) && ((HOUR) <= (uint32_t)12))
elmot 1:d0dfbce63a89 821
elmot 1:d0dfbce63a89 822 #define IS_RTC_HOUR24(HOUR) ((HOUR) <= (uint32_t)23)
elmot 1:d0dfbce63a89 823
elmot 1:d0dfbce63a89 824 #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= (uint32_t)59)
elmot 1:d0dfbce63a89 825
elmot 1:d0dfbce63a89 826 #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= (uint32_t)59)
elmot 1:d0dfbce63a89 827
elmot 1:d0dfbce63a89 828 /**
elmot 1:d0dfbce63a89 829 * @}
elmot 1:d0dfbce63a89 830 */
elmot 1:d0dfbce63a89 831
elmot 1:d0dfbce63a89 832 /**
elmot 1:d0dfbce63a89 833 * @}
elmot 1:d0dfbce63a89 834 */
elmot 1:d0dfbce63a89 835
elmot 1:d0dfbce63a89 836 /* Private functions ---------------------------------------------------------*/
elmot 1:d0dfbce63a89 837 /** @addtogroup RTC_Private_Functions
elmot 1:d0dfbce63a89 838 * @{
elmot 1:d0dfbce63a89 839 */
elmot 1:d0dfbce63a89 840
elmot 1:d0dfbce63a89 841 HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef* hrtc);
elmot 1:d0dfbce63a89 842 uint8_t RTC_ByteToBcd2(uint8_t Value);
elmot 1:d0dfbce63a89 843 uint8_t RTC_Bcd2ToByte(uint8_t Value);
elmot 1:d0dfbce63a89 844
elmot 1:d0dfbce63a89 845 /**
elmot 1:d0dfbce63a89 846 * @}
elmot 1:d0dfbce63a89 847 */
elmot 1:d0dfbce63a89 848
elmot 1:d0dfbce63a89 849 /**
elmot 1:d0dfbce63a89 850 * @}
elmot 1:d0dfbce63a89 851 */
elmot 1:d0dfbce63a89 852
elmot 1:d0dfbce63a89 853 /**
elmot 1:d0dfbce63a89 854 * @}
elmot 1:d0dfbce63a89 855 */
elmot 1:d0dfbce63a89 856
elmot 1:d0dfbce63a89 857 #ifdef __cplusplus
elmot 1:d0dfbce63a89 858 }
elmot 1:d0dfbce63a89 859 #endif
elmot 1:d0dfbce63a89 860
elmot 1:d0dfbce63a89 861 #endif /* __STM32L4xx_HAL_RTC_H */
elmot 1:d0dfbce63a89 862
elmot 1:d0dfbce63a89 863 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/