Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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