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