stm32f4xx_hal_rtc.h 37 KB

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