Mouse code for the MacroRat
mbed-dev/targets/TARGET_STM/TARGET_STM32F2/device/stm32f2xx_hal_rtc.h@18:6a4db94011d3, 2017-05-14 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Sun May 14 23:18:57 2017 +0000
- Revision:
- 18:6a4db94011d3
Publishing again
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 18:6a4db94011d3 | 1 | /** |
sahilmgandhi | 18:6a4db94011d3 | 2 | ****************************************************************************** |
sahilmgandhi | 18:6a4db94011d3 | 3 | * @file stm32f2xx_hal_rtc.h |
sahilmgandhi | 18:6a4db94011d3 | 4 | * @author MCD Application Team |
sahilmgandhi | 18:6a4db94011d3 | 5 | * @version V1.1.3 |
sahilmgandhi | 18:6a4db94011d3 | 6 | * @date 29-June-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>© 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 __STM32F2xx_HAL_RTC_H |
sahilmgandhi | 18:6a4db94011d3 | 40 | #define __STM32F2xx_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 "stm32f2xx_hal_def.h" |
sahilmgandhi | 18:6a4db94011d3 | 48 | |
sahilmgandhi | 18:6a4db94011d3 | 49 | /** @addtogroup STM32F2xx_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 | |
sahilmgandhi | 18:6a4db94011d3 | 73 | }HAL_RTCStateTypeDef; |
sahilmgandhi | 18:6a4db94011d3 | 74 | |
sahilmgandhi | 18:6a4db94011d3 | 75 | /** |
sahilmgandhi | 18:6a4db94011d3 | 76 | * @brief RTC Configuration Structure definition |
sahilmgandhi | 18:6a4db94011d3 | 77 | */ |
sahilmgandhi | 18:6a4db94011d3 | 78 | typedef struct |
sahilmgandhi | 18:6a4db94011d3 | 79 | { |
sahilmgandhi | 18:6a4db94011d3 | 80 | uint32_t HourFormat; /*!< Specifies the RTC Hour Format. |
sahilmgandhi | 18:6a4db94011d3 | 81 | This parameter can be a value of @ref RTC_Hour_Formats */ |
sahilmgandhi | 18:6a4db94011d3 | 82 | |
sahilmgandhi | 18:6a4db94011d3 | 83 | uint32_t AsynchPrediv; /*!< Specifies the RTC Asynchronous Predivider value. |
sahilmgandhi | 18:6a4db94011d3 | 84 | This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x7F */ |
sahilmgandhi | 18:6a4db94011d3 | 85 | |
sahilmgandhi | 18:6a4db94011d3 | 86 | uint32_t SynchPrediv; /*!< Specifies the RTC Synchronous Predivider value. |
sahilmgandhi | 18:6a4db94011d3 | 87 | This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1FFF */ |
sahilmgandhi | 18:6a4db94011d3 | 88 | |
sahilmgandhi | 18:6a4db94011d3 | 89 | uint32_t OutPut; /*!< Specifies which signal will be routed to the RTC output. |
sahilmgandhi | 18:6a4db94011d3 | 90 | This parameter can be a value of @ref RTC_Output_selection_Definitions */ |
sahilmgandhi | 18:6a4db94011d3 | 91 | |
sahilmgandhi | 18:6a4db94011d3 | 92 | uint32_t OutPutPolarity; /*!< Specifies the polarity of the output signal. |
sahilmgandhi | 18:6a4db94011d3 | 93 | This parameter can be a value of @ref RTC_Output_Polarity_Definitions */ |
sahilmgandhi | 18:6a4db94011d3 | 94 | |
sahilmgandhi | 18:6a4db94011d3 | 95 | uint32_t OutPutType; /*!< Specifies the RTC Output Pin mode. |
sahilmgandhi | 18:6a4db94011d3 | 96 | This parameter can be a value of @ref RTC_Output_Type_ALARM_OUT */ |
sahilmgandhi | 18:6a4db94011d3 | 97 | }RTC_InitTypeDef; |
sahilmgandhi | 18:6a4db94011d3 | 98 | |
sahilmgandhi | 18:6a4db94011d3 | 99 | /** |
sahilmgandhi | 18:6a4db94011d3 | 100 | * @brief RTC Time structure definition |
sahilmgandhi | 18:6a4db94011d3 | 101 | */ |
sahilmgandhi | 18:6a4db94011d3 | 102 | typedef struct |
sahilmgandhi | 18:6a4db94011d3 | 103 | { |
sahilmgandhi | 18:6a4db94011d3 | 104 | uint8_t Hours; /*!< Specifies the RTC Time Hour. |
sahilmgandhi | 18:6a4db94011d3 | 105 | This parameter must be a number between Min_Data = 0 and Max_Data = 12 if the RTC_HourFormat_12 is selected. |
sahilmgandhi | 18:6a4db94011d3 | 106 | This parameter must be a number between Min_Data = 0 and Max_Data = 23 if the RTC_HourFormat_24 is selected */ |
sahilmgandhi | 18:6a4db94011d3 | 107 | |
sahilmgandhi | 18:6a4db94011d3 | 108 | uint8_t Minutes; /*!< Specifies the RTC Time Minutes. |
sahilmgandhi | 18:6a4db94011d3 | 109 | This parameter must be a number between Min_Data = 0 and Max_Data = 59 */ |
sahilmgandhi | 18:6a4db94011d3 | 110 | |
sahilmgandhi | 18:6a4db94011d3 | 111 | uint8_t Seconds; /*!< Specifies the RTC Time Seconds. |
sahilmgandhi | 18:6a4db94011d3 | 112 | This parameter must be a number between Min_Data = 0 and Max_Data = 59 */ |
sahilmgandhi | 18:6a4db94011d3 | 113 | |
sahilmgandhi | 18:6a4db94011d3 | 114 | uint8_t TimeFormat; /*!< Specifies the RTC AM/PM Time. |
sahilmgandhi | 18:6a4db94011d3 | 115 | This parameter can be a value of @ref RTC_AM_PM_Definitions */ |
sahilmgandhi | 18:6a4db94011d3 | 116 | |
sahilmgandhi | 18:6a4db94011d3 | 117 | uint32_t DayLightSaving; /*!< Specifies DayLight Save Operation. |
sahilmgandhi | 18:6a4db94011d3 | 118 | This parameter can be a value of @ref RTC_DayLightSaving_Definitions */ |
sahilmgandhi | 18:6a4db94011d3 | 119 | |
sahilmgandhi | 18:6a4db94011d3 | 120 | uint32_t StoreOperation; /*!< Specifies RTC_StoreOperation value to be written in the BCK bit |
sahilmgandhi | 18:6a4db94011d3 | 121 | in CR register to store the operation. |
sahilmgandhi | 18:6a4db94011d3 | 122 | This parameter can be a value of @ref RTC_StoreOperation_Definitions */ |
sahilmgandhi | 18:6a4db94011d3 | 123 | }RTC_TimeTypeDef; |
sahilmgandhi | 18:6a4db94011d3 | 124 | |
sahilmgandhi | 18:6a4db94011d3 | 125 | /** |
sahilmgandhi | 18:6a4db94011d3 | 126 | * @brief RTC Date structure definition |
sahilmgandhi | 18:6a4db94011d3 | 127 | */ |
sahilmgandhi | 18:6a4db94011d3 | 128 | typedef struct |
sahilmgandhi | 18:6a4db94011d3 | 129 | { |
sahilmgandhi | 18:6a4db94011d3 | 130 | uint8_t WeekDay; /*!< Specifies the RTC Date WeekDay. |
sahilmgandhi | 18:6a4db94011d3 | 131 | This parameter can be a value of @ref RTC_WeekDay_Definitions */ |
sahilmgandhi | 18:6a4db94011d3 | 132 | |
sahilmgandhi | 18:6a4db94011d3 | 133 | uint8_t Month; /*!< Specifies the RTC Date Month (in BCD format). |
sahilmgandhi | 18:6a4db94011d3 | 134 | This parameter can be a value of @ref RTC_Month_Date_Definitions */ |
sahilmgandhi | 18:6a4db94011d3 | 135 | |
sahilmgandhi | 18:6a4db94011d3 | 136 | uint8_t Date; /*!< Specifies the RTC Date. |
sahilmgandhi | 18:6a4db94011d3 | 137 | This parameter must be a number between Min_Data = 1 and Max_Data = 31 */ |
sahilmgandhi | 18:6a4db94011d3 | 138 | |
sahilmgandhi | 18:6a4db94011d3 | 139 | uint8_t Year; /*!< Specifies the RTC Date Year. |
sahilmgandhi | 18:6a4db94011d3 | 140 | This parameter must be a number between Min_Data = 0 and Max_Data = 99 */ |
sahilmgandhi | 18:6a4db94011d3 | 141 | |
sahilmgandhi | 18:6a4db94011d3 | 142 | }RTC_DateTypeDef; |
sahilmgandhi | 18:6a4db94011d3 | 143 | |
sahilmgandhi | 18:6a4db94011d3 | 144 | /** |
sahilmgandhi | 18:6a4db94011d3 | 145 | * @brief RTC Alarm structure definition |
sahilmgandhi | 18:6a4db94011d3 | 146 | */ |
sahilmgandhi | 18:6a4db94011d3 | 147 | typedef struct |
sahilmgandhi | 18:6a4db94011d3 | 148 | { |
sahilmgandhi | 18:6a4db94011d3 | 149 | RTC_TimeTypeDef AlarmTime; /*!< Specifies the RTC Alarm Time members */ |
sahilmgandhi | 18:6a4db94011d3 | 150 | |
sahilmgandhi | 18:6a4db94011d3 | 151 | uint32_t AlarmMask; /*!< Specifies the RTC Alarm Masks. |
sahilmgandhi | 18:6a4db94011d3 | 152 | This parameter can be a value of @ref RTC_AlarmMask_Definitions */ |
sahilmgandhi | 18:6a4db94011d3 | 153 | |
sahilmgandhi | 18:6a4db94011d3 | 154 | uint32_t AlarmDateWeekDaySel; /*!< Specifies the RTC Alarm is on Date or WeekDay. |
sahilmgandhi | 18:6a4db94011d3 | 155 | This parameter can be a value of @ref RTC_AlarmDateWeekDay_Definitions */ |
sahilmgandhi | 18:6a4db94011d3 | 156 | |
sahilmgandhi | 18:6a4db94011d3 | 157 | uint8_t AlarmDateWeekDay; /*!< Specifies the RTC Alarm Date/WeekDay. |
sahilmgandhi | 18:6a4db94011d3 | 158 | If the Alarm Date is selected, this parameter must be set to a value in the 1-31 range. |
sahilmgandhi | 18:6a4db94011d3 | 159 | If the Alarm WeekDay is selected, this parameter can be a value of @ref RTC_WeekDay_Definitions */ |
sahilmgandhi | 18:6a4db94011d3 | 160 | |
sahilmgandhi | 18:6a4db94011d3 | 161 | uint32_t Alarm; /*!< Specifies the alarm . |
sahilmgandhi | 18:6a4db94011d3 | 162 | This parameter can be a value of @ref RTC_Alarms_Definitions */ |
sahilmgandhi | 18:6a4db94011d3 | 163 | }RTC_AlarmTypeDef; |
sahilmgandhi | 18:6a4db94011d3 | 164 | |
sahilmgandhi | 18:6a4db94011d3 | 165 | /** |
sahilmgandhi | 18:6a4db94011d3 | 166 | * @brief RTC Handle Structure definition |
sahilmgandhi | 18:6a4db94011d3 | 167 | */ |
sahilmgandhi | 18:6a4db94011d3 | 168 | typedef struct |
sahilmgandhi | 18:6a4db94011d3 | 169 | { |
sahilmgandhi | 18:6a4db94011d3 | 170 | RTC_TypeDef *Instance; /*!< Register base address */ |
sahilmgandhi | 18:6a4db94011d3 | 171 | |
sahilmgandhi | 18:6a4db94011d3 | 172 | RTC_InitTypeDef Init; /*!< RTC required parameters */ |
sahilmgandhi | 18:6a4db94011d3 | 173 | |
sahilmgandhi | 18:6a4db94011d3 | 174 | HAL_LockTypeDef Lock; /*!< RTC locking object */ |
sahilmgandhi | 18:6a4db94011d3 | 175 | |
sahilmgandhi | 18:6a4db94011d3 | 176 | __IO HAL_RTCStateTypeDef State; /*!< Time communication state */ |
sahilmgandhi | 18:6a4db94011d3 | 177 | |
sahilmgandhi | 18:6a4db94011d3 | 178 | }RTC_HandleTypeDef; |
sahilmgandhi | 18:6a4db94011d3 | 179 | |
sahilmgandhi | 18:6a4db94011d3 | 180 | /** |
sahilmgandhi | 18:6a4db94011d3 | 181 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 182 | */ |
sahilmgandhi | 18:6a4db94011d3 | 183 | |
sahilmgandhi | 18:6a4db94011d3 | 184 | /* Exported constants --------------------------------------------------------*/ |
sahilmgandhi | 18:6a4db94011d3 | 185 | /** @defgroup RTC_Exported_Constants RTC Exported Constants |
sahilmgandhi | 18:6a4db94011d3 | 186 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 187 | */ |
sahilmgandhi | 18:6a4db94011d3 | 188 | |
sahilmgandhi | 18:6a4db94011d3 | 189 | /** @defgroup RTC_Hour_Formats RTC Hour Formats |
sahilmgandhi | 18:6a4db94011d3 | 190 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 191 | */ |
sahilmgandhi | 18:6a4db94011d3 | 192 | #define RTC_HOURFORMAT_24 ((uint32_t)0x00000000U) |
sahilmgandhi | 18:6a4db94011d3 | 193 | #define RTC_HOURFORMAT_12 ((uint32_t)0x00000040U) |
sahilmgandhi | 18:6a4db94011d3 | 194 | /** |
sahilmgandhi | 18:6a4db94011d3 | 195 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 196 | */ |
sahilmgandhi | 18:6a4db94011d3 | 197 | |
sahilmgandhi | 18:6a4db94011d3 | 198 | /** @defgroup RTC_Output_selection_Definitions RTC Output Selection Definitions |
sahilmgandhi | 18:6a4db94011d3 | 199 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 200 | */ |
sahilmgandhi | 18:6a4db94011d3 | 201 | #define RTC_OUTPUT_DISABLE ((uint32_t)0x00000000U) |
sahilmgandhi | 18:6a4db94011d3 | 202 | #define RTC_OUTPUT_ALARMA ((uint32_t)0x00200000U) |
sahilmgandhi | 18:6a4db94011d3 | 203 | #define RTC_OUTPUT_ALARMB ((uint32_t)0x00400000U) |
sahilmgandhi | 18:6a4db94011d3 | 204 | #define RTC_OUTPUT_WAKEUP ((uint32_t)0x00600000U) |
sahilmgandhi | 18:6a4db94011d3 | 205 | /** |
sahilmgandhi | 18:6a4db94011d3 | 206 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 207 | */ |
sahilmgandhi | 18:6a4db94011d3 | 208 | |
sahilmgandhi | 18:6a4db94011d3 | 209 | /** @defgroup RTC_Output_Polarity_Definitions RTC Output Polarity Definitions |
sahilmgandhi | 18:6a4db94011d3 | 210 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 211 | */ |
sahilmgandhi | 18:6a4db94011d3 | 212 | #define RTC_OUTPUT_POLARITY_HIGH ((uint32_t)0x00000000U) |
sahilmgandhi | 18:6a4db94011d3 | 213 | #define RTC_OUTPUT_POLARITY_LOW ((uint32_t)0x00100000U) |
sahilmgandhi | 18:6a4db94011d3 | 214 | /** |
sahilmgandhi | 18:6a4db94011d3 | 215 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 216 | */ |
sahilmgandhi | 18:6a4db94011d3 | 217 | |
sahilmgandhi | 18:6a4db94011d3 | 218 | /** @defgroup RTC_Output_Type_ALARM_OUT RTC Output Type ALARM OUT |
sahilmgandhi | 18:6a4db94011d3 | 219 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 220 | */ |
sahilmgandhi | 18:6a4db94011d3 | 221 | #define RTC_OUTPUT_TYPE_OPENDRAIN ((uint32_t)0x00000000U) |
sahilmgandhi | 18:6a4db94011d3 | 222 | #define RTC_OUTPUT_TYPE_PUSHPULL ((uint32_t)0x00040000U) |
sahilmgandhi | 18:6a4db94011d3 | 223 | /** |
sahilmgandhi | 18:6a4db94011d3 | 224 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 225 | */ |
sahilmgandhi | 18:6a4db94011d3 | 226 | |
sahilmgandhi | 18:6a4db94011d3 | 227 | /** @defgroup RTC_AM_PM_Definitions RTC AM PM Definitions |
sahilmgandhi | 18:6a4db94011d3 | 228 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 229 | */ |
sahilmgandhi | 18:6a4db94011d3 | 230 | #define RTC_HOURFORMAT12_AM ((uint8_t)0x00U) |
sahilmgandhi | 18:6a4db94011d3 | 231 | #define RTC_HOURFORMAT12_PM ((uint8_t)0x40U) |
sahilmgandhi | 18:6a4db94011d3 | 232 | /** |
sahilmgandhi | 18:6a4db94011d3 | 233 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 234 | */ |
sahilmgandhi | 18:6a4db94011d3 | 235 | |
sahilmgandhi | 18:6a4db94011d3 | 236 | /** @defgroup RTC_DayLightSaving_Definitions RTC DayLight Saving Definitions |
sahilmgandhi | 18:6a4db94011d3 | 237 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 238 | */ |
sahilmgandhi | 18:6a4db94011d3 | 239 | #define RTC_DAYLIGHTSAVING_SUB1H ((uint32_t)0x00020000U) |
sahilmgandhi | 18:6a4db94011d3 | 240 | #define RTC_DAYLIGHTSAVING_ADD1H ((uint32_t)0x00010000U) |
sahilmgandhi | 18:6a4db94011d3 | 241 | #define RTC_DAYLIGHTSAVING_NONE ((uint32_t)0x00000000U) |
sahilmgandhi | 18:6a4db94011d3 | 242 | /** |
sahilmgandhi | 18:6a4db94011d3 | 243 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 244 | */ |
sahilmgandhi | 18:6a4db94011d3 | 245 | |
sahilmgandhi | 18:6a4db94011d3 | 246 | /** @defgroup RTC_StoreOperation_Definitions RTC Store Operation Definitions |
sahilmgandhi | 18:6a4db94011d3 | 247 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 248 | */ |
sahilmgandhi | 18:6a4db94011d3 | 249 | #define RTC_STOREOPERATION_RESET ((uint32_t)0x00000000U) |
sahilmgandhi | 18:6a4db94011d3 | 250 | #define RTC_STOREOPERATION_SET ((uint32_t)0x00040000U) |
sahilmgandhi | 18:6a4db94011d3 | 251 | /** |
sahilmgandhi | 18:6a4db94011d3 | 252 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 253 | */ |
sahilmgandhi | 18:6a4db94011d3 | 254 | |
sahilmgandhi | 18:6a4db94011d3 | 255 | /** @defgroup RTC_Input_parameter_format_definitions RTC Input Parameter Format Definitions |
sahilmgandhi | 18:6a4db94011d3 | 256 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 257 | */ |
sahilmgandhi | 18:6a4db94011d3 | 258 | #define RTC_FORMAT_BIN ((uint32_t)0x000000000U) |
sahilmgandhi | 18:6a4db94011d3 | 259 | #define RTC_FORMAT_BCD ((uint32_t)0x000000001U) |
sahilmgandhi | 18:6a4db94011d3 | 260 | /** |
sahilmgandhi | 18:6a4db94011d3 | 261 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 262 | */ |
sahilmgandhi | 18:6a4db94011d3 | 263 | |
sahilmgandhi | 18:6a4db94011d3 | 264 | /** @defgroup RTC_Month_Date_Definitions RTC Month Date Definitions |
sahilmgandhi | 18:6a4db94011d3 | 265 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 266 | */ |
sahilmgandhi | 18:6a4db94011d3 | 267 | /* Coded in BCD format */ |
sahilmgandhi | 18:6a4db94011d3 | 268 | #define RTC_MONTH_JANUARY ((uint8_t)0x01U) |
sahilmgandhi | 18:6a4db94011d3 | 269 | #define RTC_MONTH_FEBRUARY ((uint8_t)0x02U) |
sahilmgandhi | 18:6a4db94011d3 | 270 | #define RTC_MONTH_MARCH ((uint8_t)0x03U) |
sahilmgandhi | 18:6a4db94011d3 | 271 | #define RTC_MONTH_APRIL ((uint8_t)0x04U) |
sahilmgandhi | 18:6a4db94011d3 | 272 | #define RTC_MONTH_MAY ((uint8_t)0x05U) |
sahilmgandhi | 18:6a4db94011d3 | 273 | #define RTC_MONTH_JUNE ((uint8_t)0x06U) |
sahilmgandhi | 18:6a4db94011d3 | 274 | #define RTC_MONTH_JULY ((uint8_t)0x07U) |
sahilmgandhi | 18:6a4db94011d3 | 275 | #define RTC_MONTH_AUGUST ((uint8_t)0x08U) |
sahilmgandhi | 18:6a4db94011d3 | 276 | #define RTC_MONTH_SEPTEMBER ((uint8_t)0x09U) |
sahilmgandhi | 18:6a4db94011d3 | 277 | #define RTC_MONTH_OCTOBER ((uint8_t)0x10U) |
sahilmgandhi | 18:6a4db94011d3 | 278 | #define RTC_MONTH_NOVEMBER ((uint8_t)0x11U) |
sahilmgandhi | 18:6a4db94011d3 | 279 | #define RTC_MONTH_DECEMBER ((uint8_t)0x12U) |
sahilmgandhi | 18:6a4db94011d3 | 280 | /** |
sahilmgandhi | 18:6a4db94011d3 | 281 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 282 | */ |
sahilmgandhi | 18:6a4db94011d3 | 283 | |
sahilmgandhi | 18:6a4db94011d3 | 284 | /** @defgroup RTC_WeekDay_Definitions RTC WeekDay Definitions |
sahilmgandhi | 18:6a4db94011d3 | 285 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 286 | */ |
sahilmgandhi | 18:6a4db94011d3 | 287 | #define RTC_WEEKDAY_MONDAY ((uint8_t)0x01U) |
sahilmgandhi | 18:6a4db94011d3 | 288 | #define RTC_WEEKDAY_TUESDAY ((uint8_t)0x02U) |
sahilmgandhi | 18:6a4db94011d3 | 289 | #define RTC_WEEKDAY_WEDNESDAY ((uint8_t)0x03U) |
sahilmgandhi | 18:6a4db94011d3 | 290 | #define RTC_WEEKDAY_THURSDAY ((uint8_t)0x04U) |
sahilmgandhi | 18:6a4db94011d3 | 291 | #define RTC_WEEKDAY_FRIDAY ((uint8_t)0x05U) |
sahilmgandhi | 18:6a4db94011d3 | 292 | #define RTC_WEEKDAY_SATURDAY ((uint8_t)0x06U) |
sahilmgandhi | 18:6a4db94011d3 | 293 | #define RTC_WEEKDAY_SUNDAY ((uint8_t)0x07U) |
sahilmgandhi | 18:6a4db94011d3 | 294 | /** |
sahilmgandhi | 18:6a4db94011d3 | 295 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 296 | */ |
sahilmgandhi | 18:6a4db94011d3 | 297 | |
sahilmgandhi | 18:6a4db94011d3 | 298 | /** @defgroup RTC_AlarmDateWeekDay_Definitions RTC Alarm Date WeekDay Definitions |
sahilmgandhi | 18:6a4db94011d3 | 299 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 300 | */ |
sahilmgandhi | 18:6a4db94011d3 | 301 | #define RTC_ALARMDATEWEEKDAYSEL_DATE ((uint32_t)0x00000000U) |
sahilmgandhi | 18:6a4db94011d3 | 302 | #define RTC_ALARMDATEWEEKDAYSEL_WEEKDAY ((uint32_t)0x40000000U) |
sahilmgandhi | 18:6a4db94011d3 | 303 | /** |
sahilmgandhi | 18:6a4db94011d3 | 304 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 305 | */ |
sahilmgandhi | 18:6a4db94011d3 | 306 | |
sahilmgandhi | 18:6a4db94011d3 | 307 | /** @defgroup RTC_AlarmMask_Definitions RTC Alarm Mask Definitions |
sahilmgandhi | 18:6a4db94011d3 | 308 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 309 | */ |
sahilmgandhi | 18:6a4db94011d3 | 310 | #define RTC_ALARMMASK_NONE ((uint32_t)0x00000000U) |
sahilmgandhi | 18:6a4db94011d3 | 311 | #define RTC_ALARMMASK_DATEWEEKDAY RTC_ALRMAR_MSK4 |
sahilmgandhi | 18:6a4db94011d3 | 312 | #define RTC_ALARMMASK_HOURS RTC_ALRMAR_MSK3 |
sahilmgandhi | 18:6a4db94011d3 | 313 | #define RTC_ALARMMASK_MINUTES RTC_ALRMAR_MSK2 |
sahilmgandhi | 18:6a4db94011d3 | 314 | #define RTC_ALARMMASK_SECONDS RTC_ALRMAR_MSK1 |
sahilmgandhi | 18:6a4db94011d3 | 315 | #define RTC_ALARMMASK_ALL ((uint32_t)0x80808080U) |
sahilmgandhi | 18:6a4db94011d3 | 316 | /** |
sahilmgandhi | 18:6a4db94011d3 | 317 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 318 | */ |
sahilmgandhi | 18:6a4db94011d3 | 319 | |
sahilmgandhi | 18:6a4db94011d3 | 320 | /** @defgroup RTC_Alarms_Definitions RTC Alarms Definitions |
sahilmgandhi | 18:6a4db94011d3 | 321 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 322 | */ |
sahilmgandhi | 18:6a4db94011d3 | 323 | #define RTC_ALARM_A RTC_CR_ALRAE |
sahilmgandhi | 18:6a4db94011d3 | 324 | #define RTC_ALARM_B RTC_CR_ALRBE |
sahilmgandhi | 18:6a4db94011d3 | 325 | /** |
sahilmgandhi | 18:6a4db94011d3 | 326 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 327 | */ |
sahilmgandhi | 18:6a4db94011d3 | 328 | |
sahilmgandhi | 18:6a4db94011d3 | 329 | /** @defgroup RTC_Interrupts_Definitions RTC Interrupts Definitions |
sahilmgandhi | 18:6a4db94011d3 | 330 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 331 | */ |
sahilmgandhi | 18:6a4db94011d3 | 332 | #define RTC_IT_TS ((uint32_t)0x00008000U) |
sahilmgandhi | 18:6a4db94011d3 | 333 | #define RTC_IT_WUT ((uint32_t)0x00004000U) |
sahilmgandhi | 18:6a4db94011d3 | 334 | #define RTC_IT_ALRB ((uint32_t)0x00002000U) |
sahilmgandhi | 18:6a4db94011d3 | 335 | #define RTC_IT_ALRA ((uint32_t)0x00001000U) |
sahilmgandhi | 18:6a4db94011d3 | 336 | #define RTC_IT_TAMP ((uint32_t)0x00000004U) /* Used only to Enable the Tamper Interrupt */ |
sahilmgandhi | 18:6a4db94011d3 | 337 | #define RTC_IT_TAMP1 ((uint32_t)0x00020000U) |
sahilmgandhi | 18:6a4db94011d3 | 338 | /** |
sahilmgandhi | 18:6a4db94011d3 | 339 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 340 | */ |
sahilmgandhi | 18:6a4db94011d3 | 341 | |
sahilmgandhi | 18:6a4db94011d3 | 342 | /** @defgroup RTC_Flags_Definitions RTC Flags Definitions |
sahilmgandhi | 18:6a4db94011d3 | 343 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 344 | */ |
sahilmgandhi | 18:6a4db94011d3 | 345 | #define RTC_FLAG_TAMP1F ((uint32_t)0x00002000U) |
sahilmgandhi | 18:6a4db94011d3 | 346 | #define RTC_FLAG_TSOVF ((uint32_t)0x00001000U) |
sahilmgandhi | 18:6a4db94011d3 | 347 | #define RTC_FLAG_TSF ((uint32_t)0x00000800U) |
sahilmgandhi | 18:6a4db94011d3 | 348 | #define RTC_FLAG_WUTF ((uint32_t)0x00000400U) |
sahilmgandhi | 18:6a4db94011d3 | 349 | #define RTC_FLAG_ALRBF ((uint32_t)0x00000200U) |
sahilmgandhi | 18:6a4db94011d3 | 350 | #define RTC_FLAG_ALRAF ((uint32_t)0x00000100U) |
sahilmgandhi | 18:6a4db94011d3 | 351 | #define RTC_FLAG_INITF ((uint32_t)0x00000040U) |
sahilmgandhi | 18:6a4db94011d3 | 352 | #define RTC_FLAG_RSF ((uint32_t)0x00000020U) |
sahilmgandhi | 18:6a4db94011d3 | 353 | #define RTC_FLAG_INITS ((uint32_t)0x00000010U) |
sahilmgandhi | 18:6a4db94011d3 | 354 | #define RTC_FLAG_WUTWF ((uint32_t)0x00000004U) |
sahilmgandhi | 18:6a4db94011d3 | 355 | #define RTC_FLAG_ALRBWF ((uint32_t)0x00000002U) |
sahilmgandhi | 18:6a4db94011d3 | 356 | #define RTC_FLAG_ALRAWF ((uint32_t)0x00000001U) |
sahilmgandhi | 18:6a4db94011d3 | 357 | /** |
sahilmgandhi | 18:6a4db94011d3 | 358 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 359 | */ |
sahilmgandhi | 18:6a4db94011d3 | 360 | |
sahilmgandhi | 18:6a4db94011d3 | 361 | /** |
sahilmgandhi | 18:6a4db94011d3 | 362 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 363 | */ |
sahilmgandhi | 18:6a4db94011d3 | 364 | |
sahilmgandhi | 18:6a4db94011d3 | 365 | /* Exported macro ------------------------------------------------------------*/ |
sahilmgandhi | 18:6a4db94011d3 | 366 | /** @defgroup RTC_Exported_Macros RTC Exported Macros |
sahilmgandhi | 18:6a4db94011d3 | 367 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 368 | */ |
sahilmgandhi | 18:6a4db94011d3 | 369 | |
sahilmgandhi | 18:6a4db94011d3 | 370 | /** @brief Reset RTC handle state |
sahilmgandhi | 18:6a4db94011d3 | 371 | * @param __HANDLE__: specifies the RTC handle. |
sahilmgandhi | 18:6a4db94011d3 | 372 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 373 | */ |
sahilmgandhi | 18:6a4db94011d3 | 374 | #define __HAL_RTC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RTC_STATE_RESET) |
sahilmgandhi | 18:6a4db94011d3 | 375 | |
sahilmgandhi | 18:6a4db94011d3 | 376 | /** |
sahilmgandhi | 18:6a4db94011d3 | 377 | * @brief Disable the write protection for RTC registers. |
sahilmgandhi | 18:6a4db94011d3 | 378 | * @param __HANDLE__: specifies the RTC handle. |
sahilmgandhi | 18:6a4db94011d3 | 379 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 380 | */ |
sahilmgandhi | 18:6a4db94011d3 | 381 | #define __HAL_RTC_WRITEPROTECTION_DISABLE(__HANDLE__) \ |
sahilmgandhi | 18:6a4db94011d3 | 382 | do{ \ |
sahilmgandhi | 18:6a4db94011d3 | 383 | (__HANDLE__)->Instance->WPR = 0xCAU; \ |
sahilmgandhi | 18:6a4db94011d3 | 384 | (__HANDLE__)->Instance->WPR = 0x53U; \ |
sahilmgandhi | 18:6a4db94011d3 | 385 | } while(0) |
sahilmgandhi | 18:6a4db94011d3 | 386 | |
sahilmgandhi | 18:6a4db94011d3 | 387 | /** |
sahilmgandhi | 18:6a4db94011d3 | 388 | * @brief Enable the write protection for RTC registers. |
sahilmgandhi | 18:6a4db94011d3 | 389 | * @param __HANDLE__: specifies the RTC handle. |
sahilmgandhi | 18:6a4db94011d3 | 390 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 391 | */ |
sahilmgandhi | 18:6a4db94011d3 | 392 | #define __HAL_RTC_WRITEPROTECTION_ENABLE(__HANDLE__) \ |
sahilmgandhi | 18:6a4db94011d3 | 393 | do{ \ |
sahilmgandhi | 18:6a4db94011d3 | 394 | (__HANDLE__)->Instance->WPR = 0xFFU; \ |
sahilmgandhi | 18:6a4db94011d3 | 395 | } while(0) |
sahilmgandhi | 18:6a4db94011d3 | 396 | |
sahilmgandhi | 18:6a4db94011d3 | 397 | /** |
sahilmgandhi | 18:6a4db94011d3 | 398 | * @brief Enable the RTC ALARMA peripheral. |
sahilmgandhi | 18:6a4db94011d3 | 399 | * @param __HANDLE__: specifies the RTC handle. |
sahilmgandhi | 18:6a4db94011d3 | 400 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 401 | */ |
sahilmgandhi | 18:6a4db94011d3 | 402 | #define __HAL_RTC_ALARMA_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRAE)) |
sahilmgandhi | 18:6a4db94011d3 | 403 | |
sahilmgandhi | 18:6a4db94011d3 | 404 | /** |
sahilmgandhi | 18:6a4db94011d3 | 405 | * @brief Disable the RTC ALARMA peripheral. |
sahilmgandhi | 18:6a4db94011d3 | 406 | * @param __HANDLE__: specifies the RTC handle. |
sahilmgandhi | 18:6a4db94011d3 | 407 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 408 | */ |
sahilmgandhi | 18:6a4db94011d3 | 409 | #define __HAL_RTC_ALARMA_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRAE)) |
sahilmgandhi | 18:6a4db94011d3 | 410 | |
sahilmgandhi | 18:6a4db94011d3 | 411 | /** |
sahilmgandhi | 18:6a4db94011d3 | 412 | * @brief Enable the RTC ALARMB peripheral. |
sahilmgandhi | 18:6a4db94011d3 | 413 | * @param __HANDLE__: specifies the RTC handle. |
sahilmgandhi | 18:6a4db94011d3 | 414 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 415 | */ |
sahilmgandhi | 18:6a4db94011d3 | 416 | #define __HAL_RTC_ALARMB_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (RTC_CR_ALRBE)) |
sahilmgandhi | 18:6a4db94011d3 | 417 | |
sahilmgandhi | 18:6a4db94011d3 | 418 | /** |
sahilmgandhi | 18:6a4db94011d3 | 419 | * @brief Disable the RTC ALARMB peripheral. |
sahilmgandhi | 18:6a4db94011d3 | 420 | * @param __HANDLE__: specifies the RTC handle. |
sahilmgandhi | 18:6a4db94011d3 | 421 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 422 | */ |
sahilmgandhi | 18:6a4db94011d3 | 423 | #define __HAL_RTC_ALARMB_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(RTC_CR_ALRBE)) |
sahilmgandhi | 18:6a4db94011d3 | 424 | |
sahilmgandhi | 18:6a4db94011d3 | 425 | /** |
sahilmgandhi | 18:6a4db94011d3 | 426 | * @brief Enable the RTC Alarm interrupt. |
sahilmgandhi | 18:6a4db94011d3 | 427 | * @param __HANDLE__: specifies the RTC handle. |
sahilmgandhi | 18:6a4db94011d3 | 428 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled. |
sahilmgandhi | 18:6a4db94011d3 | 429 | * This parameter can be any combination of the following values: |
sahilmgandhi | 18:6a4db94011d3 | 430 | * @arg RTC_IT_ALRA: Alarm A interrupt |
sahilmgandhi | 18:6a4db94011d3 | 431 | * @arg RTC_IT_ALRB: Alarm B interrupt |
sahilmgandhi | 18:6a4db94011d3 | 432 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 433 | */ |
sahilmgandhi | 18:6a4db94011d3 | 434 | #define __HAL_RTC_ALARM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__)) |
sahilmgandhi | 18:6a4db94011d3 | 435 | |
sahilmgandhi | 18:6a4db94011d3 | 436 | /** |
sahilmgandhi | 18:6a4db94011d3 | 437 | * @brief Disable the RTC Alarm interrupt. |
sahilmgandhi | 18:6a4db94011d3 | 438 | * @param __HANDLE__: specifies the RTC handle. |
sahilmgandhi | 18:6a4db94011d3 | 439 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to be enabled or disabled. |
sahilmgandhi | 18:6a4db94011d3 | 440 | * This parameter can be any combination of the following values: |
sahilmgandhi | 18:6a4db94011d3 | 441 | * @arg RTC_IT_ALRA: Alarm A interrupt |
sahilmgandhi | 18:6a4db94011d3 | 442 | * @arg RTC_IT_ALRB: Alarm B interrupt |
sahilmgandhi | 18:6a4db94011d3 | 443 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 444 | */ |
sahilmgandhi | 18:6a4db94011d3 | 445 | #define __HAL_RTC_ALARM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__)) |
sahilmgandhi | 18:6a4db94011d3 | 446 | |
sahilmgandhi | 18:6a4db94011d3 | 447 | /** |
sahilmgandhi | 18:6a4db94011d3 | 448 | * @brief Check whether the specified RTC Alarm interrupt has occurred or not. |
sahilmgandhi | 18:6a4db94011d3 | 449 | * @param __HANDLE__: specifies the RTC handle. |
sahilmgandhi | 18:6a4db94011d3 | 450 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt to check. |
sahilmgandhi | 18:6a4db94011d3 | 451 | * This parameter can be: |
sahilmgandhi | 18:6a4db94011d3 | 452 | * @arg RTC_IT_ALRA: Alarm A interrupt |
sahilmgandhi | 18:6a4db94011d3 | 453 | * @arg RTC_IT_ALRB: Alarm B interrupt |
sahilmgandhi | 18:6a4db94011d3 | 454 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 455 | */ |
sahilmgandhi | 18:6a4db94011d3 | 456 | #define __HAL_RTC_ALARM_GET_IT(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->ISR)& ((__INTERRUPT__)>> 4U)) != RESET)? SET : RESET) |
sahilmgandhi | 18:6a4db94011d3 | 457 | |
sahilmgandhi | 18:6a4db94011d3 | 458 | /** |
sahilmgandhi | 18:6a4db94011d3 | 459 | * @brief Get the selected RTC Alarm's flag status. |
sahilmgandhi | 18:6a4db94011d3 | 460 | * @param __HANDLE__: specifies the RTC handle. |
sahilmgandhi | 18:6a4db94011d3 | 461 | * @param __FLAG__: specifies the RTC Alarm Flag to check. |
sahilmgandhi | 18:6a4db94011d3 | 462 | * This parameter can be: |
sahilmgandhi | 18:6a4db94011d3 | 463 | * @arg RTC_FLAG_ALRAF |
sahilmgandhi | 18:6a4db94011d3 | 464 | * @arg RTC_FLAG_ALRBF |
sahilmgandhi | 18:6a4db94011d3 | 465 | * @arg RTC_FLAG_ALRAWF |
sahilmgandhi | 18:6a4db94011d3 | 466 | * @arg RTC_FLAG_ALRBWF |
sahilmgandhi | 18:6a4db94011d3 | 467 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 468 | */ |
sahilmgandhi | 18:6a4db94011d3 | 469 | #define __HAL_RTC_ALARM_GET_FLAG(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->ISR) & (__FLAG__)) != RESET)? SET : RESET) |
sahilmgandhi | 18:6a4db94011d3 | 470 | |
sahilmgandhi | 18:6a4db94011d3 | 471 | /** |
sahilmgandhi | 18:6a4db94011d3 | 472 | * @brief Clear the RTC Alarm's pending flags. |
sahilmgandhi | 18:6a4db94011d3 | 473 | * @param __HANDLE__: specifies the RTC handle. |
sahilmgandhi | 18:6a4db94011d3 | 474 | * @param __FLAG__: specifies the RTC Alarm Flag sources to be enabled or disabled. |
sahilmgandhi | 18:6a4db94011d3 | 475 | * This parameter can be: |
sahilmgandhi | 18:6a4db94011d3 | 476 | * @arg RTC_FLAG_ALRAF |
sahilmgandhi | 18:6a4db94011d3 | 477 | * @arg RTC_FLAG_ALRBF |
sahilmgandhi | 18:6a4db94011d3 | 478 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 479 | */ |
sahilmgandhi | 18:6a4db94011d3 | 480 | #define __HAL_RTC_ALARM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR) = (~((__FLAG__) | RTC_ISR_INIT)|((__HANDLE__)->Instance->ISR & RTC_ISR_INIT)) |
sahilmgandhi | 18:6a4db94011d3 | 481 | |
sahilmgandhi | 18:6a4db94011d3 | 482 | |
sahilmgandhi | 18:6a4db94011d3 | 483 | /** |
sahilmgandhi | 18:6a4db94011d3 | 484 | * @brief Check whether the specified RTC Alarm interrupt has been enabled or not. |
sahilmgandhi | 18:6a4db94011d3 | 485 | * @param __HANDLE__: specifies the RTC handle. |
sahilmgandhi | 18:6a4db94011d3 | 486 | * @param __INTERRUPT__: specifies the RTC Alarm interrupt sources to check. |
sahilmgandhi | 18:6a4db94011d3 | 487 | * This parameter can be: |
sahilmgandhi | 18:6a4db94011d3 | 488 | * @arg RTC_IT_ALRA: Alarm A interrupt |
sahilmgandhi | 18:6a4db94011d3 | 489 | * @arg RTC_IT_ALRB: Alarm B interrupt |
sahilmgandhi | 18:6a4db94011d3 | 490 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 491 | */ |
sahilmgandhi | 18:6a4db94011d3 | 492 | #define __HAL_RTC_ALARM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((((__HANDLE__)->Instance->CR) & (__INTERRUPT__)) != RESET) ? SET : RESET) |
sahilmgandhi | 18:6a4db94011d3 | 493 | |
sahilmgandhi | 18:6a4db94011d3 | 494 | /** |
sahilmgandhi | 18:6a4db94011d3 | 495 | * @brief Enable interrupt on the RTC Alarm associated Exti line. |
sahilmgandhi | 18:6a4db94011d3 | 496 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 497 | */ |
sahilmgandhi | 18:6a4db94011d3 | 498 | #define __HAL_RTC_ALARM_EXTI_ENABLE_IT() (EXTI->IMR |= RTC_EXTI_LINE_ALARM_EVENT) |
sahilmgandhi | 18:6a4db94011d3 | 499 | |
sahilmgandhi | 18:6a4db94011d3 | 500 | /** |
sahilmgandhi | 18:6a4db94011d3 | 501 | * @brief Disable interrupt on the RTC Alarm associated Exti line. |
sahilmgandhi | 18:6a4db94011d3 | 502 | * @retval None |
sahilmgandhi | 18:6a4db94011d3 | 503 | */ |
sahilmgandhi | 18:6a4db94011d3 | 504 | #define __HAL_RTC_ALARM_EXTI_DISABLE_IT() (EXTI->IMR &= ~(RTC_EXTI_LINE_ALARM_EVENT)) |
sahilmgandhi | 18:6a4db94011d3 | 505 | |
sahilmgandhi | 18:6a4db94011d3 | 506 | /** |
sahilmgandhi | 18:6a4db94011d3 | 507 | * @brief Enable event on the RTC Alarm associated Exti line. |
sahilmgandhi | 18:6a4db94011d3 | 508 | * @retval None. |
sahilmgandhi | 18:6a4db94011d3 | 509 | */ |
sahilmgandhi | 18:6a4db94011d3 | 510 | #define __HAL_RTC_ALARM_EXTI_ENABLE_EVENT() (EXTI->EMR |= RTC_EXTI_LINE_ALARM_EVENT) |
sahilmgandhi | 18:6a4db94011d3 | 511 | |
sahilmgandhi | 18:6a4db94011d3 | 512 | /** |
sahilmgandhi | 18:6a4db94011d3 | 513 | * @brief Disable event on the RTC Alarm associated Exti line. |
sahilmgandhi | 18:6a4db94011d3 | 514 | * @retval None. |
sahilmgandhi | 18:6a4db94011d3 | 515 | */ |
sahilmgandhi | 18:6a4db94011d3 | 516 | #define __HAL_RTC_ALARM_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(RTC_EXTI_LINE_ALARM_EVENT)) |
sahilmgandhi | 18:6a4db94011d3 | 517 | |
sahilmgandhi | 18:6a4db94011d3 | 518 | /** |
sahilmgandhi | 18:6a4db94011d3 | 519 | * @brief Enable falling edge trigger on the RTC Alarm associated Exti line. |
sahilmgandhi | 18:6a4db94011d3 | 520 | * @retval None. |
sahilmgandhi | 18:6a4db94011d3 | 521 | */ |
sahilmgandhi | 18:6a4db94011d3 | 522 | #define __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR |= RTC_EXTI_LINE_ALARM_EVENT) |
sahilmgandhi | 18:6a4db94011d3 | 523 | |
sahilmgandhi | 18:6a4db94011d3 | 524 | /** |
sahilmgandhi | 18:6a4db94011d3 | 525 | * @brief Disable falling edge trigger on the RTC Alarm associated Exti line. |
sahilmgandhi | 18:6a4db94011d3 | 526 | * @retval None. |
sahilmgandhi | 18:6a4db94011d3 | 527 | */ |
sahilmgandhi | 18:6a4db94011d3 | 528 | #define __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR &= ~(RTC_EXTI_LINE_ALARM_EVENT)) |
sahilmgandhi | 18:6a4db94011d3 | 529 | |
sahilmgandhi | 18:6a4db94011d3 | 530 | /** |
sahilmgandhi | 18:6a4db94011d3 | 531 | * @brief Enable rising edge trigger on the RTC Alarm associated Exti line. |
sahilmgandhi | 18:6a4db94011d3 | 532 | * @retval None. |
sahilmgandhi | 18:6a4db94011d3 | 533 | */ |
sahilmgandhi | 18:6a4db94011d3 | 534 | #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR |= RTC_EXTI_LINE_ALARM_EVENT) |
sahilmgandhi | 18:6a4db94011d3 | 535 | |
sahilmgandhi | 18:6a4db94011d3 | 536 | /** |
sahilmgandhi | 18:6a4db94011d3 | 537 | * @brief Disable rising edge trigger on the RTC Alarm associated Exti line. |
sahilmgandhi | 18:6a4db94011d3 | 538 | * @retval None. |
sahilmgandhi | 18:6a4db94011d3 | 539 | */ |
sahilmgandhi | 18:6a4db94011d3 | 540 | #define __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR &= ~(RTC_EXTI_LINE_ALARM_EVENT)) |
sahilmgandhi | 18:6a4db94011d3 | 541 | |
sahilmgandhi | 18:6a4db94011d3 | 542 | /** |
sahilmgandhi | 18:6a4db94011d3 | 543 | * @brief Enable rising & falling edge trigger on the RTC Alarm associated Exti line. |
sahilmgandhi | 18:6a4db94011d3 | 544 | * @retval None. |
sahilmgandhi | 18:6a4db94011d3 | 545 | */ |
sahilmgandhi | 18:6a4db94011d3 | 546 | #define __HAL_RTC_ALARM_EXTI_ENABLE_RISING_FALLING_EDGE() do{ __HAL_RTC_ALARM_EXTI_ENABLE_RISING_EDGE();\ |
sahilmgandhi | 18:6a4db94011d3 | 547 | __HAL_RTC_ALARM_EXTI_ENABLE_FALLING_EDGE();\ |
sahilmgandhi | 18:6a4db94011d3 | 548 | }while(0) |
sahilmgandhi | 18:6a4db94011d3 | 549 | |
sahilmgandhi | 18:6a4db94011d3 | 550 | /** |
sahilmgandhi | 18:6a4db94011d3 | 551 | * @brief Disable rising & falling edge trigger 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_DISABLE_RISING_FALLING_EDGE() do{ __HAL_RTC_ALARM_EXTI_DISABLE_RISING_EDGE();\ |
sahilmgandhi | 18:6a4db94011d3 | 555 | __HAL_RTC_ALARM_EXTI_DISABLE_FALLING_EDGE();\ |
sahilmgandhi | 18:6a4db94011d3 | 556 | }while(0) |
sahilmgandhi | 18:6a4db94011d3 | 557 | |
sahilmgandhi | 18:6a4db94011d3 | 558 | /** |
sahilmgandhi | 18:6a4db94011d3 | 559 | * @brief Check whether the RTC Alarm associated Exti line interrupt flag is set or not. |
sahilmgandhi | 18:6a4db94011d3 | 560 | * @retval Line Status. |
sahilmgandhi | 18:6a4db94011d3 | 561 | */ |
sahilmgandhi | 18:6a4db94011d3 | 562 | #define __HAL_RTC_ALARM_EXTI_GET_FLAG() (EXTI->PR & RTC_EXTI_LINE_ALARM_EVENT) |
sahilmgandhi | 18:6a4db94011d3 | 563 | |
sahilmgandhi | 18:6a4db94011d3 | 564 | /** |
sahilmgandhi | 18:6a4db94011d3 | 565 | * @brief Clear the RTC Alarm associated Exti line flag. |
sahilmgandhi | 18:6a4db94011d3 | 566 | * @retval None. |
sahilmgandhi | 18:6a4db94011d3 | 567 | */ |
sahilmgandhi | 18:6a4db94011d3 | 568 | #define __HAL_RTC_ALARM_EXTI_CLEAR_FLAG() (EXTI->PR = RTC_EXTI_LINE_ALARM_EVENT) |
sahilmgandhi | 18:6a4db94011d3 | 569 | |
sahilmgandhi | 18:6a4db94011d3 | 570 | /** |
sahilmgandhi | 18:6a4db94011d3 | 571 | * @brief Generate a Software interrupt on RTC Alarm associated Exti line. |
sahilmgandhi | 18:6a4db94011d3 | 572 | * @retval None. |
sahilmgandhi | 18:6a4db94011d3 | 573 | */ |
sahilmgandhi | 18:6a4db94011d3 | 574 | #define __HAL_RTC_ALARM_EXTI_GENERATE_SWIT() (EXTI->SWIER |= RTC_EXTI_LINE_ALARM_EVENT) |
sahilmgandhi | 18:6a4db94011d3 | 575 | /** |
sahilmgandhi | 18:6a4db94011d3 | 576 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 577 | */ |
sahilmgandhi | 18:6a4db94011d3 | 578 | |
sahilmgandhi | 18:6a4db94011d3 | 579 | /* Include RTC HAL Extension module */ |
sahilmgandhi | 18:6a4db94011d3 | 580 | #include "stm32f2xx_hal_rtc_ex.h" |
sahilmgandhi | 18:6a4db94011d3 | 581 | |
sahilmgandhi | 18:6a4db94011d3 | 582 | /* Exported functions --------------------------------------------------------*/ |
sahilmgandhi | 18:6a4db94011d3 | 583 | /** @addtogroup RTC_Exported_Functions |
sahilmgandhi | 18:6a4db94011d3 | 584 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 585 | */ |
sahilmgandhi | 18:6a4db94011d3 | 586 | |
sahilmgandhi | 18:6a4db94011d3 | 587 | /** @addtogroup RTC_Exported_Functions_Group1 |
sahilmgandhi | 18:6a4db94011d3 | 588 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 589 | */ |
sahilmgandhi | 18:6a4db94011d3 | 590 | /* Initialization and de-initialization functions ****************************/ |
sahilmgandhi | 18:6a4db94011d3 | 591 | HAL_StatusTypeDef HAL_RTC_Init(RTC_HandleTypeDef *hrtc); |
sahilmgandhi | 18:6a4db94011d3 | 592 | HAL_StatusTypeDef HAL_RTC_DeInit(RTC_HandleTypeDef *hrtc); |
sahilmgandhi | 18:6a4db94011d3 | 593 | void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc); |
sahilmgandhi | 18:6a4db94011d3 | 594 | void HAL_RTC_MspDeInit(RTC_HandleTypeDef *hrtc); |
sahilmgandhi | 18:6a4db94011d3 | 595 | /** |
sahilmgandhi | 18:6a4db94011d3 | 596 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 597 | */ |
sahilmgandhi | 18:6a4db94011d3 | 598 | |
sahilmgandhi | 18:6a4db94011d3 | 599 | /** @addtogroup RTC_Exported_Functions_Group2 |
sahilmgandhi | 18:6a4db94011d3 | 600 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 601 | */ |
sahilmgandhi | 18:6a4db94011d3 | 602 | /* RTC Time and Date functions ************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 603 | HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format); |
sahilmgandhi | 18:6a4db94011d3 | 604 | HAL_StatusTypeDef HAL_RTC_GetTime(RTC_HandleTypeDef *hrtc, RTC_TimeTypeDef *sTime, uint32_t Format); |
sahilmgandhi | 18:6a4db94011d3 | 605 | HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format); |
sahilmgandhi | 18:6a4db94011d3 | 606 | HAL_StatusTypeDef HAL_RTC_GetDate(RTC_HandleTypeDef *hrtc, RTC_DateTypeDef *sDate, uint32_t Format); |
sahilmgandhi | 18:6a4db94011d3 | 607 | /** |
sahilmgandhi | 18:6a4db94011d3 | 608 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 609 | */ |
sahilmgandhi | 18:6a4db94011d3 | 610 | |
sahilmgandhi | 18:6a4db94011d3 | 611 | /** @addtogroup RTC_Exported_Functions_Group3 |
sahilmgandhi | 18:6a4db94011d3 | 612 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 613 | */ |
sahilmgandhi | 18:6a4db94011d3 | 614 | /* RTC Alarm functions ********************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 615 | HAL_StatusTypeDef HAL_RTC_SetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format); |
sahilmgandhi | 18:6a4db94011d3 | 616 | HAL_StatusTypeDef HAL_RTC_SetAlarm_IT(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Format); |
sahilmgandhi | 18:6a4db94011d3 | 617 | HAL_StatusTypeDef HAL_RTC_DeactivateAlarm(RTC_HandleTypeDef *hrtc, uint32_t Alarm); |
sahilmgandhi | 18:6a4db94011d3 | 618 | HAL_StatusTypeDef HAL_RTC_GetAlarm(RTC_HandleTypeDef *hrtc, RTC_AlarmTypeDef *sAlarm, uint32_t Alarm, uint32_t Format); |
sahilmgandhi | 18:6a4db94011d3 | 619 | void HAL_RTC_AlarmIRQHandler(RTC_HandleTypeDef *hrtc); |
sahilmgandhi | 18:6a4db94011d3 | 620 | HAL_StatusTypeDef HAL_RTC_PollForAlarmAEvent(RTC_HandleTypeDef *hrtc, uint32_t Timeout); |
sahilmgandhi | 18:6a4db94011d3 | 621 | void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc); |
sahilmgandhi | 18:6a4db94011d3 | 622 | /** |
sahilmgandhi | 18:6a4db94011d3 | 623 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 624 | */ |
sahilmgandhi | 18:6a4db94011d3 | 625 | |
sahilmgandhi | 18:6a4db94011d3 | 626 | /** @addtogroup RTC_Exported_Functions_Group4 |
sahilmgandhi | 18:6a4db94011d3 | 627 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 628 | */ |
sahilmgandhi | 18:6a4db94011d3 | 629 | /* Peripheral Control functions ***********************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 630 | HAL_StatusTypeDef HAL_RTC_WaitForSynchro(RTC_HandleTypeDef* hrtc); |
sahilmgandhi | 18:6a4db94011d3 | 631 | /** |
sahilmgandhi | 18:6a4db94011d3 | 632 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 633 | */ |
sahilmgandhi | 18:6a4db94011d3 | 634 | |
sahilmgandhi | 18:6a4db94011d3 | 635 | /** @addtogroup RTC_Exported_Functions_Group5 |
sahilmgandhi | 18:6a4db94011d3 | 636 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 637 | */ |
sahilmgandhi | 18:6a4db94011d3 | 638 | /* Peripheral State functions *************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 639 | HAL_RTCStateTypeDef HAL_RTC_GetState(RTC_HandleTypeDef *hrtc); |
sahilmgandhi | 18:6a4db94011d3 | 640 | /** |
sahilmgandhi | 18:6a4db94011d3 | 641 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 642 | */ |
sahilmgandhi | 18:6a4db94011d3 | 643 | |
sahilmgandhi | 18:6a4db94011d3 | 644 | /** |
sahilmgandhi | 18:6a4db94011d3 | 645 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 646 | */ |
sahilmgandhi | 18:6a4db94011d3 | 647 | |
sahilmgandhi | 18:6a4db94011d3 | 648 | /* Private types -------------------------------------------------------------*/ |
sahilmgandhi | 18:6a4db94011d3 | 649 | /* Private variables ---------------------------------------------------------*/ |
sahilmgandhi | 18:6a4db94011d3 | 650 | /* Private constants ---------------------------------------------------------*/ |
sahilmgandhi | 18:6a4db94011d3 | 651 | /** @defgroup RTC_Private_Constants RTC Private Constants |
sahilmgandhi | 18:6a4db94011d3 | 652 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 653 | */ |
sahilmgandhi | 18:6a4db94011d3 | 654 | /* Masks Definition */ |
sahilmgandhi | 18:6a4db94011d3 | 655 | #define RTC_TR_RESERVED_MASK ((uint32_t)0x007F7F7FU) |
sahilmgandhi | 18:6a4db94011d3 | 656 | #define RTC_DR_RESERVED_MASK ((uint32_t)0x00FFFF3FU) |
sahilmgandhi | 18:6a4db94011d3 | 657 | #define RTC_INIT_MASK ((uint32_t)0xFFFFFFFFU) |
sahilmgandhi | 18:6a4db94011d3 | 658 | #define RTC_RSF_MASK ((uint32_t)0xFFFFFF5FU) |
sahilmgandhi | 18:6a4db94011d3 | 659 | #define RTC_FLAGS_MASK ((uint32_t)(RTC_FLAG_TSOVF | RTC_FLAG_TSF | RTC_FLAG_WUTF | \ |
sahilmgandhi | 18:6a4db94011d3 | 660 | RTC_FLAG_ALRBF | RTC_FLAG_ALRAF | RTC_FLAG_INITF | \ |
sahilmgandhi | 18:6a4db94011d3 | 661 | RTC_FLAG_RSF | RTC_FLAG_INITS | RTC_FLAG_WUTWF | \ |
sahilmgandhi | 18:6a4db94011d3 | 662 | RTC_FLAG_ALRBWF | RTC_FLAG_ALRAWF | RTC_FLAG_TAMP1F)) |
sahilmgandhi | 18:6a4db94011d3 | 663 | |
sahilmgandhi | 18:6a4db94011d3 | 664 | #define RTC_TIMEOUT_VALUE 1000 |
sahilmgandhi | 18:6a4db94011d3 | 665 | |
sahilmgandhi | 18:6a4db94011d3 | 666 | #define RTC_EXTI_LINE_ALARM_EVENT ((uint32_t)EXTI_IMR_MR17) /*!< External interrupt line 17 Connected to the RTC Alarm event */ |
sahilmgandhi | 18:6a4db94011d3 | 667 | /** |
sahilmgandhi | 18:6a4db94011d3 | 668 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 669 | */ |
sahilmgandhi | 18:6a4db94011d3 | 670 | |
sahilmgandhi | 18:6a4db94011d3 | 671 | /* Private macros ------------------------------------------------------------*/ |
sahilmgandhi | 18:6a4db94011d3 | 672 | /** @defgroup RTC_Private_Macros RTC Private Macros |
sahilmgandhi | 18:6a4db94011d3 | 673 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 674 | */ |
sahilmgandhi | 18:6a4db94011d3 | 675 | |
sahilmgandhi | 18:6a4db94011d3 | 676 | /** @defgroup RTC_IS_RTC_Definitions RTC Private macros to check input parameters |
sahilmgandhi | 18:6a4db94011d3 | 677 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 678 | */ |
sahilmgandhi | 18:6a4db94011d3 | 679 | #define IS_RTC_HOUR_FORMAT(FORMAT) (((FORMAT) == RTC_HOURFORMAT_12) || \ |
sahilmgandhi | 18:6a4db94011d3 | 680 | ((FORMAT) == RTC_HOURFORMAT_24)) |
sahilmgandhi | 18:6a4db94011d3 | 681 | #define IS_RTC_OUTPUT(OUTPUT) (((OUTPUT) == RTC_OUTPUT_DISABLE) || \ |
sahilmgandhi | 18:6a4db94011d3 | 682 | ((OUTPUT) == RTC_OUTPUT_ALARMA) || \ |
sahilmgandhi | 18:6a4db94011d3 | 683 | ((OUTPUT) == RTC_OUTPUT_ALARMB) || \ |
sahilmgandhi | 18:6a4db94011d3 | 684 | ((OUTPUT) == RTC_OUTPUT_WAKEUP)) |
sahilmgandhi | 18:6a4db94011d3 | 685 | #define IS_RTC_OUTPUT_POL(POL) (((POL) == RTC_OUTPUT_POLARITY_HIGH) || \ |
sahilmgandhi | 18:6a4db94011d3 | 686 | ((POL) == RTC_OUTPUT_POLARITY_LOW)) |
sahilmgandhi | 18:6a4db94011d3 | 687 | #define IS_RTC_OUTPUT_TYPE(TYPE) (((TYPE) == RTC_OUTPUT_TYPE_OPENDRAIN) || \ |
sahilmgandhi | 18:6a4db94011d3 | 688 | ((TYPE) == RTC_OUTPUT_TYPE_PUSHPULL)) |
sahilmgandhi | 18:6a4db94011d3 | 689 | #define IS_RTC_HOUR12(HOUR) (((HOUR) > (uint32_t)0U) && ((HOUR) <= (uint32_t)12U)) |
sahilmgandhi | 18:6a4db94011d3 | 690 | #define IS_RTC_HOUR24(HOUR) ((HOUR) <= (uint32_t)23U) |
sahilmgandhi | 18:6a4db94011d3 | 691 | #define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= (uint32_t)0x7FU) |
sahilmgandhi | 18:6a4db94011d3 | 692 | #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= (uint32_t)0x1FFFU) |
sahilmgandhi | 18:6a4db94011d3 | 693 | #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= (uint32_t)59U) |
sahilmgandhi | 18:6a4db94011d3 | 694 | #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= (uint32_t)59U) |
sahilmgandhi | 18:6a4db94011d3 | 695 | |
sahilmgandhi | 18:6a4db94011d3 | 696 | #define IS_RTC_HOURFORMAT12(PM) (((PM) == RTC_HOURFORMAT12_AM) || ((PM) == RTC_HOURFORMAT12_PM)) |
sahilmgandhi | 18:6a4db94011d3 | 697 | #define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DAYLIGHTSAVING_SUB1H) || \ |
sahilmgandhi | 18:6a4db94011d3 | 698 | ((SAVE) == RTC_DAYLIGHTSAVING_ADD1H) || \ |
sahilmgandhi | 18:6a4db94011d3 | 699 | ((SAVE) == RTC_DAYLIGHTSAVING_NONE)) |
sahilmgandhi | 18:6a4db94011d3 | 700 | #define IS_RTC_STORE_OPERATION(OPERATION) (((OPERATION) == RTC_STOREOPERATION_RESET) || \ |
sahilmgandhi | 18:6a4db94011d3 | 701 | ((OPERATION) == RTC_STOREOPERATION_SET)) |
sahilmgandhi | 18:6a4db94011d3 | 702 | #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_FORMAT_BIN) || ((FORMAT) == RTC_FORMAT_BCD)) |
sahilmgandhi | 18:6a4db94011d3 | 703 | #define IS_RTC_YEAR(YEAR) ((YEAR) <= (uint32_t)99U) |
sahilmgandhi | 18:6a4db94011d3 | 704 | #define IS_RTC_MONTH(MONTH) (((MONTH) >= (uint32_t)1U) && ((MONTH) <= (uint32_t)12U)) |
sahilmgandhi | 18:6a4db94011d3 | 705 | #define IS_RTC_DATE(DATE) (((DATE) >= (uint32_t)1U) && ((DATE) <= (uint32_t)31U)) |
sahilmgandhi | 18:6a4db94011d3 | 706 | #define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \ |
sahilmgandhi | 18:6a4db94011d3 | 707 | ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \ |
sahilmgandhi | 18:6a4db94011d3 | 708 | ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \ |
sahilmgandhi | 18:6a4db94011d3 | 709 | ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \ |
sahilmgandhi | 18:6a4db94011d3 | 710 | ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \ |
sahilmgandhi | 18:6a4db94011d3 | 711 | ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \ |
sahilmgandhi | 18:6a4db94011d3 | 712 | ((WEEKDAY) == RTC_WEEKDAY_SUNDAY)) |
sahilmgandhi | 18:6a4db94011d3 | 713 | #define IS_RTC_ALARM_DATE_WEEKDAY_DATE(DATE) (((DATE) >(uint32_t) 0) && ((DATE) <= (uint32_t)31)) |
sahilmgandhi | 18:6a4db94011d3 | 714 | #define IS_RTC_ALARM_DATE_WEEKDAY_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_WEEKDAY_MONDAY) || \ |
sahilmgandhi | 18:6a4db94011d3 | 715 | ((WEEKDAY) == RTC_WEEKDAY_TUESDAY) || \ |
sahilmgandhi | 18:6a4db94011d3 | 716 | ((WEEKDAY) == RTC_WEEKDAY_WEDNESDAY) || \ |
sahilmgandhi | 18:6a4db94011d3 | 717 | ((WEEKDAY) == RTC_WEEKDAY_THURSDAY) || \ |
sahilmgandhi | 18:6a4db94011d3 | 718 | ((WEEKDAY) == RTC_WEEKDAY_FRIDAY) || \ |
sahilmgandhi | 18:6a4db94011d3 | 719 | ((WEEKDAY) == RTC_WEEKDAY_SATURDAY) || \ |
sahilmgandhi | 18:6a4db94011d3 | 720 | ((WEEKDAY) == RTC_WEEKDAY_SUNDAY)) |
sahilmgandhi | 18:6a4db94011d3 | 721 | #define IS_RTC_ALARM_DATE_WEEKDAY_SEL(SEL) (((SEL) == RTC_ALARMDATEWEEKDAYSEL_DATE) || \ |
sahilmgandhi | 18:6a4db94011d3 | 722 | ((SEL) == RTC_ALARMDATEWEEKDAYSEL_WEEKDAY)) |
sahilmgandhi | 18:6a4db94011d3 | 723 | #define IS_RTC_ALARM_MASK(MASK) (((MASK) & 0x7F7F7F7FU) == (uint32_t)RESET) |
sahilmgandhi | 18:6a4db94011d3 | 724 | #define IS_RTC_ALARM(ALARM) (((ALARM) == RTC_ALARM_A) || ((ALARM) == RTC_ALARM_B)) |
sahilmgandhi | 18:6a4db94011d3 | 725 | /** |
sahilmgandhi | 18:6a4db94011d3 | 726 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 727 | */ |
sahilmgandhi | 18:6a4db94011d3 | 728 | |
sahilmgandhi | 18:6a4db94011d3 | 729 | /** |
sahilmgandhi | 18:6a4db94011d3 | 730 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 731 | */ |
sahilmgandhi | 18:6a4db94011d3 | 732 | |
sahilmgandhi | 18:6a4db94011d3 | 733 | /* Private functions ---------------------------------------------------------*/ |
sahilmgandhi | 18:6a4db94011d3 | 734 | /** @defgroup RTC_Private_Functions RTC Private Functions |
sahilmgandhi | 18:6a4db94011d3 | 735 | * @{ |
sahilmgandhi | 18:6a4db94011d3 | 736 | */ |
sahilmgandhi | 18:6a4db94011d3 | 737 | HAL_StatusTypeDef RTC_EnterInitMode(RTC_HandleTypeDef* hrtc); |
sahilmgandhi | 18:6a4db94011d3 | 738 | uint8_t RTC_ByteToBcd2(uint8_t Value); |
sahilmgandhi | 18:6a4db94011d3 | 739 | uint8_t RTC_Bcd2ToByte(uint8_t Value); |
sahilmgandhi | 18:6a4db94011d3 | 740 | /** |
sahilmgandhi | 18:6a4db94011d3 | 741 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 742 | */ |
sahilmgandhi | 18:6a4db94011d3 | 743 | |
sahilmgandhi | 18:6a4db94011d3 | 744 | /** |
sahilmgandhi | 18:6a4db94011d3 | 745 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 746 | */ |
sahilmgandhi | 18:6a4db94011d3 | 747 | |
sahilmgandhi | 18:6a4db94011d3 | 748 | /** |
sahilmgandhi | 18:6a4db94011d3 | 749 | * @} |
sahilmgandhi | 18:6a4db94011d3 | 750 | */ |
sahilmgandhi | 18:6a4db94011d3 | 751 | |
sahilmgandhi | 18:6a4db94011d3 | 752 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 753 | } |
sahilmgandhi | 18:6a4db94011d3 | 754 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 755 | |
sahilmgandhi | 18:6a4db94011d3 | 756 | #endif /* __STM32F2xx_HAL_RTC_H */ |
sahilmgandhi | 18:6a4db94011d3 | 757 | |
sahilmgandhi | 18:6a4db94011d3 | 758 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |