Hal Drivers for L4

Dependents:   BSP OneHopeOnePrayer FINAL_AUDIO_RECORD AudioDemo

Fork of STM32L4xx_HAL_Driver by Senior Design: Sound Monitor

Committer:
EricLew
Date:
Wed Nov 25 17:30:43 2015 +0000
Revision:
2:7aef7655b0a8
Parent:
0:80ee8f3b695e
commit;

Who changed what in which revision?

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