mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Thu Jul 07 14:34:11 2016 +0100
Revision:
122:f9eeca106725
Release 122 of the mbed library

Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition

Who changed what in which revision?

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