Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sat Jun 03 00:22:44 2017 +0000
Revision:
46:b156ef445742
Parent:
18:6a4db94011d3
Final code for internal battlebot competition.

Who changed what in which revision?

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