Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed Sep 16 15:32:31 2015 +0100
Revision:
107:4f6c30876dfa
Release 107  of the mbed library

Changes:
- new platforms - DISCO_F746NG, DISCO_L476VG, NUCLEO_L476RG
- KL43Z - bugfix RTC init function
- K20 - SPI mode fix

Who changed what in which revision?

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