stm8l15x_rtc.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956
  1. /**
  2. ******************************************************************************
  3. * @file stm8l15x_rtc.h
  4. * @author MCD Application Team
  5. * @version V1.6.1
  6. * @date 30-September-2014
  7. * @brief This file contains all the functions prototypes for the RTC
  8. * firmware library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
  13. *
  14. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  15. * You may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at:
  17. *
  18. * http://www.st.com/software_license_agreement_liberty_v2
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an "AS IS" BASIS,
  22. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. *
  26. ******************************************************************************
  27. */
  28. /* Define to prevent recursive inclusion -------------------------------------*/
  29. #ifndef __STM8L15x_RTC_H
  30. #define __STM8L15x_RTC_H
  31. /* Includes ------------------------------------------------------------------*/
  32. #include "stm8l15x.h"
  33. /** @addtogroup STM8L15x_StdPeriph_Driver
  34. * @{
  35. */
  36. /** @addtogroup RTC
  37. * @{
  38. */
  39. /* Exported types ------------------------------------------------------------*/
  40. /** @defgroup RTC_Exported_Types
  41. * @{
  42. */
  43. /** @defgroup RTC_Weekdays
  44. * @{
  45. */
  46. typedef enum
  47. {
  48. RTC_Weekday_Monday = ((uint8_t)0x01), /*!< WeekDay is Monday */
  49. RTC_Weekday_Tuesday = ((uint8_t)0x02), /*!< WeekDay is Tuesday */
  50. RTC_Weekday_Wednesday = ((uint8_t)0x03), /*!< WeekDay is Wednesday */
  51. RTC_Weekday_Thursday = ((uint8_t)0x04), /*!< WeekDay is Thursday */
  52. RTC_Weekday_Friday = ((uint8_t)0x05), /*!< WeekDay is Friday */
  53. RTC_Weekday_Saturday = ((uint8_t)0x06), /*!< WeekDay is Saturday */
  54. RTC_Weekday_Sunday = ((uint8_t)0x07) /*!< WeekDay is Sunday */
  55. }
  56. RTC_Weekday_TypeDef;
  57. /**
  58. * @}
  59. */
  60. /** @defgroup RTC_Months
  61. * @{
  62. */
  63. typedef enum
  64. {
  65. RTC_Month_January = ((uint8_t)0x01), /*!< Month is January */
  66. RTC_Month_February = ((uint8_t)0x02), /*!< Month is February */
  67. RTC_Month_March = ((uint8_t)0x03), /*!< Month is March */
  68. RTC_Month_April = ((uint8_t)0x04), /*!< Month is April */
  69. RTC_Month_May = ((uint8_t)0x05), /*!< Month is May */
  70. RTC_Month_June = ((uint8_t)0x06), /*!< Month is June */
  71. RTC_Month_July = ((uint8_t)0x07), /*!< Month is July */
  72. RTC_Month_August = ((uint8_t)0x08), /*!< Month is August */
  73. RTC_Month_September = ((uint8_t)0x09), /*!< Month is September */
  74. RTC_Month_October = ((uint8_t)0x10), /*!< Month is October */
  75. RTC_Month_November = ((uint8_t)0x11), /*!< Month is November */
  76. RTC_Month_December = ((uint8_t)0x12) /*!< Month is December */
  77. }
  78. RTC_Month_TypeDef;
  79. /**
  80. * @}
  81. */
  82. /** @defgroup RTC_Hour_Format
  83. * @{
  84. */
  85. typedef enum
  86. {
  87. RTC_HourFormat_24 = ((uint8_t)0x00), /*!< Hour Format is 24H */
  88. RTC_HourFormat_12 = ((uint8_t)0x40) /*!< Hour Format is 12H (using AM/PM) */
  89. }
  90. RTC_HourFormat_TypeDef;
  91. /**
  92. * @}
  93. */
  94. /** @defgroup RTC_Time
  95. * @{
  96. */
  97. typedef enum
  98. {
  99. RTC_H12_AM = ((uint8_t)0x00), /*!< AM/PM notation is AM or 24 hour format */
  100. RTC_H12_PM = ((uint8_t)0x40) /*!< AM/PM notation is PM */
  101. }
  102. RTC_H12_TypeDef;
  103. /**
  104. * @}
  105. */
  106. /** @defgroup RTC_Alarm_WeekDay_Selection
  107. * @{
  108. */
  109. typedef enum
  110. {
  111. RTC_AlarmDateWeekDaySel_Date = ((uint8_t)0x00), /*!< Date/WeekDay selection is Date */
  112. RTC_AlarmDateWeekDaySel_WeekDay = ((uint8_t)0x40) /*!< Date/WeekDay selection is WeekDay */
  113. }
  114. RTC_AlarmDateWeekDaySel_TypeDef;
  115. /**
  116. * @}
  117. */
  118. /** @defgroup RTC_Alarm_Mask
  119. * @{
  120. */
  121. typedef enum
  122. {
  123. RTC_AlarmMask_None = ((uint8_t)0x00), /*!< Alarm Masks disabled */
  124. RTC_AlarmMask_Seconds = ((uint8_t)0x80), /*!< Alarm Seconds Mask */
  125. RTC_AlarmMask_Minutes = ((uint8_t)0x40), /*!< Alarm Minutes Mask */
  126. RTC_AlarmMask_Hours = ((uint8_t)0x20), /*!< Alarm Hours Mask */
  127. RTC_AlarmMask_DateWeekDay = ((uint8_t)0x10), /*!< Alarm Date/WeekDay Mask */
  128. RTC_AlarmMask_All = ((uint8_t)0xF0) /*!< Alarm All Mask are enabled */
  129. }
  130. RTC_AlarmMask_TypeDef;
  131. /**
  132. * @}
  133. */
  134. /** @defgroup RTC_Sub_Second_Alarm_Mask
  135. * @{
  136. */
  137. typedef enum
  138. {
  139. RTC_AlarmSubSecondMask_All = ((uint8_t)0x00), /*!< All Alarm SS fields are masked. There is no comparison on sub seconds for Alarm */
  140. RTC_AlarmSubSecondMask_None = ((uint8_t)0x0F), /*!< SS[14:0] are compared and must match to activate alarm. */
  141. RTC_AlarmSubSecondMask_SS14_1 = ((uint8_t)0x01), /*!< SS[14:1] are not used in Alarm comparison. Only SS[0] is compared. */
  142. RTC_AlarmSubSecondMask_SS14_2 = ((uint8_t)0x02), /*!< SS[14:2] are not used in Alarm comparison. Only SS[1:0] are compared */
  143. RTC_AlarmSubSecondMask_SS14_3 = ((uint8_t)0x03), /*!< SS[14:3] are not used in Alarm comparison. Only SS[1:0] are compared */
  144. RTC_AlarmSubSecondMask_SS14_4 = ((uint8_t)0x04), /*!< SS[14:4] are not used in Alarm comparison. Only SS[1:0] are compared */
  145. RTC_AlarmSubSecondMask_SS14_5 = ((uint8_t)0x05), /*!< SS[14:5] are not used in Alarm comparison. Only SS[1:0] are compared */
  146. RTC_AlarmSubSecondMask_SS14_6 = ((uint8_t)0x06), /*!< SS[14:6] are not used in Alarm comparison. Only SS[1:0] are compared */
  147. RTC_AlarmSubSecondMask_SS14_7 = ((uint8_t)0x07), /*!< SS[14:7] are not used in Alarm comparison. Only SS[1:0] are compared */
  148. RTC_AlarmSubSecondMask_SS14_8 = ((uint8_t)0x08), /*!< SS[14:8] are not used in Alarm comparison. Only SS[1:0] are compared */
  149. RTC_AlarmSubSecondMask_SS14_9 = ((uint8_t)0x09), /*!< SS[14:9] are not used in Alarm comparison. Only SS[1:0] are compared */
  150. RTC_AlarmSubSecondMask_SS14_10 = ((uint8_t)0x0A), /*!< SS[14:10] are not used in Alarm comparison. Only SS[1:0] are compared */
  151. RTC_AlarmSubSecondMask_SS14_11 = ((uint8_t)0x0B), /*!< SS[14:11] are not used in Alarm comparison. Only SS[1:0] are compared */
  152. RTC_AlarmSubSecondMask_SS14_12 = ((uint8_t)0x0C), /*!< SS[14:12] are not used in Alarm comparison. Only SS[1:0] are compared */
  153. RTC_AlarmSubSecondMask_SS14_13 = ((uint8_t)0x0D), /*!< SS[14:13] are not used in Alarm comparison. Only SS[1:0] are compared */
  154. RTC_AlarmSubSecondMask_SS14 = ((uint8_t)0x0E) /*!< SS[14] is not used in Alarm comparison. Only SS[13:0] are compared */
  155. }
  156. RTC_AlarmSubSecondMask_TypeDef;
  157. /**
  158. * @}
  159. */
  160. /** @defgroup RTC_Wakeup_Clock
  161. * @{
  162. */
  163. typedef enum
  164. {
  165. RTC_WakeUpClock_RTCCLK_Div16 = ((uint8_t)0x00), /*!< (RTC clock) div 16*/
  166. RTC_WakeUpClock_RTCCLK_Div8 = ((uint8_t)0x01), /*!< (RTC clock) div 8*/
  167. RTC_WakeUpClock_RTCCLK_Div4 = ((uint8_t)0x02), /*!< (RTC clock) div 4*/
  168. RTC_WakeUpClock_RTCCLK_Div2 = ((uint8_t)0x03), /*!< (RTC clock) div 2*/
  169. RTC_WakeUpClock_CK_SPRE_16bits = ((uint8_t)0x04), /*!< CK SPRE with a counter from 0x0000 to 0xFFFF */
  170. RTC_WakeUpClock_CK_SPRE_17bits = ((uint8_t)0x06) /*!< CK SPRE with a counter from 0x10000 to 0x1FFFF */
  171. }
  172. RTC_WakeUpClock_TypeDef;
  173. /**
  174. * @}
  175. */
  176. /** @defgroup RTC_Output_Selection
  177. * @{
  178. */
  179. typedef enum
  180. {
  181. RTC_Output_Disable = ((uint8_t)0x00), /*!< RTC Alternate function Output is disabled */
  182. RTC_Output_Alarm = ((uint8_t)0x20), /*!< RTC Alternate function Output is the Alarm A event*/
  183. RTC_Output_WakeUp = ((uint8_t)0x60) /*!< RTC Alternate function Output is the WakeUp event */
  184. }
  185. RTC_Output_TypeDef;
  186. /**
  187. * @}
  188. */
  189. /** @defgroup RTC_Output_Polarity
  190. * @{
  191. */
  192. typedef enum
  193. {
  194. RTC_OutputPolarity_High = ((uint8_t)0x00), /*!< RTC Alternate function Output Polarity is High */
  195. RTC_OutputPolarity_Low = ((uint8_t)0x10) /*!< RTC Alternate function Output Polarity is Low */
  196. }
  197. RTC_OutputPolarity_TypeDef;
  198. /**
  199. * @}
  200. */
  201. /** @defgroup RTC_Calibration_Output
  202. * @{
  203. */
  204. typedef enum
  205. {
  206. RTC_CalibOutput_512Hz = ((uint8_t)0x00), /*!< RTC Calibration Output is 512Hz */
  207. RTC_CalibOutput_1Hz = ((uint8_t)0x80) /*!< RTC Calibration Output is 1Hz */
  208. }
  209. RTC_CalibOutput_TypeDef;
  210. /**
  211. * @}
  212. */
  213. /** @defgroup RTC_DayLight_Saving
  214. * @{
  215. */
  216. typedef enum
  217. {
  218. RTC_DayLightSaving_SUB1H = ((uint8_t)0x02), /*!< Substract 1 hour to the current Time (Winter Time Adjustment) */
  219. RTC_DayLightSaving_ADD1H = ((uint8_t)0x01) /*!< Add 1 hour to the current Time (Summer Time Adjustment) */
  220. }
  221. RTC_DayLightSaving_TypeDef;
  222. /**
  223. * @}
  224. */
  225. /** @defgroup RTC_Store_Operation
  226. * @{
  227. */
  228. typedef enum
  229. {
  230. RTC_StoreOperation_Set = ((uint8_t)0x04), /*!< Store Operation Set */
  231. RTC_StoreOperation_Reset = ((uint8_t)0x00) /*!< Store Operation Reset */
  232. }
  233. RTC_StoreOperation_TypeDef;
  234. /**
  235. * @}
  236. */
  237. /** @defgroup RTC_Input_Parameter_Format
  238. * @{
  239. */
  240. typedef enum
  241. {
  242. RTC_Format_BIN = ((uint8_t)0x00), /*!< Binary Format is used */
  243. RTC_Format_BCD = ((uint8_t)0x01) /*!< BCD Format is used */
  244. }
  245. RTC_Format_TypeDef;
  246. /**
  247. * @}
  248. */
  249. /** @defgroup RTC_Flags
  250. * @{
  251. */
  252. typedef enum
  253. {
  254. RTC_FLAG_TAMP3F = ((uint16_t)0x0080), /*!< TAMPER3 detection Flag. If set, tamper detection event is detected on tamper input 3 */
  255. RTC_FLAG_TAMP2F = ((uint16_t)0x0040), /*!< TAMPER2 detection Flag. If set, tamper detection event is detected on tamper input 2 */
  256. RTC_FLAG_TAMP1F = ((uint16_t)0x0020), /*!< TAMPER1 detection Flag. If set, tamper detection event is detected on tamper input 1 */
  257. RTC_FLAG_WUTF = ((uint16_t)0x0004), /*!< Wake up Timer Flag. If set, the Wake Up down counter reaches 0 */
  258. RTC_FLAG_ALRAF = ((uint16_t)0x0001), /*!< Alarm A Flag. If set, the Time/Date registers matches Alarm A registers */
  259. RTC_FLAG_INITF = ((uint16_t)0x4000), /*!< Initialisation Flag. If set,Calender registers has been initialized */
  260. RTC_FLAG_RSF = ((uint16_t)0x2000), /*!< Registers Synchronization Flag. If set,Calender registers synchronized */
  261. RTC_FLAG_INITS = ((uint16_t)0x1000), /*!< Initialisation Status Flag. If set,Calender update is allowed */
  262. RTC_FLAG_SHPF = ((uint16_t)0x0800), /*!< Shift operation pending Flag. This flag is set by hardware as soon as a shift operation is
  263. initiated by a write to the RTC_SHIFTRL. It is cleared by hardware as soon as the corresponding
  264. shift operation has completed. */
  265. RTC_FLAG_WUTWF = ((uint16_t)0x0400), /*!< Wake up Timer write Flag. If set, Wake up Timer update is allowed */
  266. RTC_FLAG_RECALPF = ((uint16_t)0x0200), /*!< Recalibration pending Flag, The status flag RECALPF is automatically set to ‘1’ when software
  267. writes to the register RTC_CALRL, indicating that the RTC_CALRx registers are blocked.
  268. When the new calibration settings are taken into account, this Flag returns by hardware to ‘0’. */
  269. RTC_FLAG_ALRAWF = ((uint16_t)0x0100) /*!< Alarm A write Flag. If set, Alarm A update is allowed */
  270. }
  271. RTC_Flag_TypeDef;
  272. /**
  273. * @}
  274. */
  275. /** @defgroup RTC_Interrupts
  276. * @{
  277. */
  278. typedef enum
  279. {
  280. RTC_IT_WUT = ((uint16_t)0x0040), /*!< Wake up Timer Interrupt */
  281. RTC_IT_ALRA = ((uint16_t)0x0010), /*!< Alarm A Interrupt */
  282. RTC_IT_TAMP = ((uint16_t)0x0F01) /*!< Tamper Interrupt */
  283. }
  284. RTC_IT_TypeDef;
  285. /**
  286. * @}
  287. */
  288. /** @defgroup RTC_Tamper_Level
  289. * @{
  290. */
  291. typedef enum
  292. {
  293. RTC_TamperLevel_Low = ((uint8_t)0x00), /*!< Tamper staying low triggers a tamper detection event. */
  294. RTC_TamperLevel_High = ((uint8_t)0x54) /*!< Tamper staying high triggers a tamper detection event. */
  295. }
  296. RTC_TamperLevel_TypeDef;
  297. /**
  298. * @}
  299. */
  300. /** @defgroup RTC_Tamper_State
  301. * @{
  302. */
  303. typedef enum
  304. {
  305. RTC_TamperState_Disable = ((uint8_t)0x00), /*!< Tamper State is Disable */
  306. RTC_TamperState_Enable = ((uint8_t)0x01) /*!< Tamper State is Enable */
  307. }
  308. RTC_TamperState_TypeDef;
  309. /**
  310. * @}
  311. */
  312. /** @defgroup RTC_Tamper_definition
  313. * @{
  314. */
  315. typedef enum
  316. {
  317. RTC_Tamper_1 = ((uint8_t)0x02), /*!< Tamper 1 selection */
  318. RTC_Tamper_2 = ((uint8_t)0x08), /*!< Tamper 2 selection */
  319. RTC_Tamper_3 = ((uint8_t)0x20) /*!< Tamper 3 selection */
  320. }
  321. RTC_Tamper_TypeDef;
  322. /**
  323. * @}
  324. */
  325. /** @defgroup RTC_Tamper_Precharge_Duration
  326. * @{
  327. */
  328. typedef enum
  329. {
  330. RTC_TamperPrechargeDuration_None = ((uint8_t)0x80), /*!< Tamper pins are not precharged before sampling */
  331. RTC_TamperPrechargeDuration_1RTCCLK = ((uint8_t)0x00), /*!< Tamper pins are precharged before sampling during 1 RTCCLK cycle */
  332. RTC_TamperPrechargeDuration_2RTCCLK = ((uint8_t)0x20), /*!< Tamper pins are precharged before sampling during 2 RTCCLK cycles */
  333. RTC_TamperPrechargeDuration_4RTCCLK = ((uint8_t)0x40), /*!< Tamper pins are precharged before sampling during 4 RTCCLK cycles */
  334. RTC_TamperPrechargeDuration_8RTCCLK = ((uint8_t)0x60) /*!< Tamper pins are precharged before sampling during 8 RTCCLK cycles */
  335. }
  336. RTC_TamperPrechargeDuration_TypeDef;
  337. /**
  338. * @}
  339. */
  340. /** @defgroup RTC_Tamper_Filter
  341. * @{
  342. */
  343. typedef enum
  344. {
  345. RTC_TamperFilter_1Sample = ((uint8_t)0x00), /*!< Tamper is activated after 1 sample at the active level */
  346. RTC_TamperFilter_2Sample = ((uint8_t)0x08), /*!< Tamper is activated after 2 consecutive samples at the active level. */
  347. RTC_TamperFilter_4Sample = ((uint8_t)0x10), /*!< Tamper is activated after 4 consecutive samples at the active level. */
  348. RTC_TamperFilter_8Sample = ((uint8_t)0x18) /*!< Tamper is activated after 8 consecutive samples at the active level. */
  349. }
  350. RTC_TamperFilter_TypeDef;
  351. /**
  352. * @}
  353. */
  354. /** @defgroup RTC_Tamper_Sampling_Frequency
  355. * @{
  356. */
  357. typedef enum
  358. {
  359. RTC_TamperSamplingFreq_RTCCLK_Div32768 = ((uint8_t)0x00), /*!< Tamper inputs are sampled with a frequency = RTCCLK / 32768 */
  360. RTC_TamperSamplingFreq_RTCCLK_Div16384 = ((uint8_t)0x01), /*!< Tamper inputs are sampled with a frequency = RTCCLK / 16384 */
  361. RTC_TamperSamplingFreq_RTCCLK_Div8192 = ((uint8_t)0x02), /*!< Tamper inputs are sampled with a frequency = RTCCLK / 8192 */
  362. RTC_TamperSamplingFreq_RTCCLK_Div4096 = ((uint8_t)0x03), /*!< Tamper inputs are sampled with a frequency = RTCCLK / 4096 */
  363. RTC_TamperSamplingFreq_RTCCLK_Div2048 = ((uint8_t)0x04), /*!< Tamper inputs are sampled with a frequency = RTCCLK / 2048 */
  364. RTC_TamperSamplingFreq_RTCCLK_Div1024 = ((uint8_t)0x05), /*!< Tamper inputs are sampled with a frequency = RTCCLK / 1024 */
  365. RTC_TamperSamplingFreq_RTCCLK_Div512 = ((uint8_t)0x06), /*!< Tamper inputs are sampled with a frequency = RTCCLK / 512 */
  366. RTC_TamperSamplingFreq_RTCCLK_Div256 = ((uint8_t)0x07) /*!< Tamper inputs are sampled with a frequency = RTCCLK / 256 */
  367. }
  368. RTC_TamperSamplingFreq_TypeDef;
  369. /**
  370. * @}
  371. */
  372. /** @defgroup RTC_Shift_Add_1s
  373. * @{
  374. */
  375. typedef enum
  376. {
  377. RTC_ShiftAdd1S_Set = ((uint8_t)0x80), /*!< Add 1 Second */
  378. RTC_ShiftAdd1S_Reset = ((uint8_t)0x00) /*!< Do not Add 1 Second */
  379. }
  380. RTC_ShiftAdd1S_TypeDef;
  381. /**
  382. * @}
  383. */
  384. /** @defgroup RTC_Smooth_Calibration_Period
  385. * @{
  386. */
  387. typedef enum
  388. {
  389. RTC_SmoothCalibPeriod_32sec = ((uint8_t)0x00), /*!< if RTCCLK = 32768 Hz, Smooth calibration period is 32s, else 2exp20 RTCCLK seconds */
  390. RTC_SmoothCalibPeriod_16sec = ((uint8_t)0x20), /*!< if RTCCLK = 32768 Hz, Smooth calibration period is 16s, else 2exp19 RTCCLK seconds */
  391. RTC_SmoothCalibPeriod_8sec = ((uint8_t)0x40) /*!< if RTCCLK = 32768 Hz, Smooth calibration period is 8s, else 2exp18 RTCCLK seconds */
  392. }
  393. RTC_SmoothCalibPeriod_TypeDef;
  394. /**
  395. * @}
  396. */
  397. /** @defgroup RTC_Smooth_Calibration_Pulses
  398. * @{
  399. */
  400. typedef enum
  401. {
  402. RTC_SmoothCalibPlusPulses_Set = ((uint8_t)0x80), /*!< The number of RTCCLK pulses added during a X -second window = Y - CALM[8:0].
  403. with Y = 512, 256, 128 when X = 32, 16, 8 */
  404. RTC_SmoothCalibPlusPulses_Reset = ((uint8_t)0x00) /*!< The number of RTCCLK pulses substituted during a 32-second window = CALM[8:0]. */
  405. }
  406. RTC_SmoothCalibPlusPulses_TypeDef;
  407. /**
  408. * @}
  409. */
  410. /**
  411. * @brief RTC Init structure definition
  412. */
  413. typedef struct
  414. {
  415. RTC_HourFormat_TypeDef RTC_HourFormat; /*!< RTC Hour Format */
  416. uint8_t RTC_AsynchPrediv; /*!< RTC Asynchronous Predivider.
  417. This parameter can be any value from
  418. 0x00 to 0x7F.*/
  419. uint16_t RTC_SynchPrediv; /*!< RTC Synchronous Predivider.
  420. This parameter can be any value from
  421. 0x0000 to 0x7FFF.*/
  422. }
  423. RTC_InitTypeDef;
  424. /**
  425. * @brief RTC Time structure definition
  426. */
  427. typedef struct
  428. {
  429. uint8_t RTC_Hours; /*!< RTC Hours.
  430. If Binary format is selected :
  431. - If RTC_Hour format is RTC_Hour format_12,
  432. this parameter can be any value from 1 to 12.
  433. - If RTC_Hour format is RTC_Hour format_24,
  434. this parameter can be any value from 0 to 23.
  435. If BCD format is selected :
  436. - If RTC_Hour format is RTC_Hour format_12,
  437. this parameter can be any BCD value from
  438. 0x01 to 0x12.
  439. - If RTC_Hour format is RTC_Hour format_24,
  440. this parameter can be any BCD value from
  441. 0x00 to 0x23.*/
  442. uint8_t RTC_Minutes; /*!< RTC Minutes.
  443. If Binary format is selected, this parameter can
  444. be any value from 0 to 59.
  445. If BCD format is selected, this parameter can
  446. be any BCD value from 0x00 to 0x59.*/
  447. uint8_t RTC_Seconds; /*!< RTC Seconds.
  448. If Binary format is selected, this parameter can
  449. be any value from 0 to 59.
  450. If BCD format is selected, this parameter can
  451. be any BCD value from 0x00 to 0x59.*/
  452. RTC_H12_TypeDef RTC_H12; /*!< RTC 12-hour clock period (AM/PM) */
  453. }
  454. RTC_TimeTypeDef;
  455. /**
  456. * @brief RTC Date structure definition
  457. */
  458. typedef struct
  459. {
  460. RTC_Weekday_TypeDef RTC_WeekDay; /*!< The RTC Calender Weekday. */
  461. RTC_Month_TypeDef RTC_Month; /*!< The RTC Calender Month. */
  462. uint8_t RTC_Date; /*!< The RTC Calender Date.
  463. If Binary format is selected, this
  464. parameter can be any value from 1 to 31.
  465. If BCD format is selected, this parameter
  466. can be any BCD value from 0x01 to 0x31.*/
  467. uint8_t RTC_Year; /*!< The RTC Calender Date.
  468. If Binary format is selected, this parameter
  469. can be any value from 0 to 99.
  470. If BCD format is selected, this parameter
  471. can be any BCD value from 0x00 to 0x99.*/
  472. }
  473. RTC_DateTypeDef;
  474. /**
  475. * @brief RTC Alarm structure definition
  476. */
  477. typedef struct
  478. {
  479. RTC_TimeTypeDef RTC_AlarmTime; /*!< RTC Alarm Time */
  480. uint8_t RTC_AlarmMask; /*!< The RTC Alarm Fields Masks. */
  481. RTC_AlarmDateWeekDaySel_TypeDef RTC_AlarmDateWeekDaySel; /*!< The RTC Alarm Date/WeekDay selection. */
  482. uint8_t RTC_AlarmDateWeekDay; /*!< The RTC Alarm Date/WeekDay value.
  483. - If RTC Alarm Date/WeekDay selection is Date
  484. and if If Binary format is selected, this
  485. parameter can be any value from 1 to 31.
  486. - If RTC Alarm Date/WeekDay selection is WeekDay,
  487. this parameter can be one of the
  488. @ref RTC_Weekday_TypeDef enumeration.*/
  489. }
  490. RTC_AlarmTypeDef;
  491. /**
  492. * @}
  493. */
  494. /* Exported constants --------------------------------------------------------*/
  495. /* Exported macros -----------------------------------------------------------*/
  496. /** @defgroup RTC_Exported_Macros
  497. * @{
  498. */
  499. /**
  500. * @brief Macro used by the assert_param function in order to check the used
  501. * Calender Hour format
  502. */
  503. #define IS_RTC_HOUR_FORMAT(FORMAT) (((FORMAT) == RTC_HourFormat_12) || \
  504. ((FORMAT) == RTC_HourFormat_24))
  505. /**
  506. * @brief Macro used by the assert_param function in order to check the used
  507. * Asynchronous Predivider
  508. */
  509. #define IS_RTC_ASYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7F)
  510. /**
  511. * @brief Macro used by the assert_param function in order to check the used
  512. * Synchronous Predivider
  513. */
  514. #define IS_RTC_SYNCH_PREDIV(PREDIV) ((PREDIV) <= 0x7FFF)
  515. /**
  516. * @brief Macro used by the assert_param function in order to check the used
  517. * Calender Hours value (format 12h)
  518. */
  519. #define IS_RTC_HOUR12_MAX(HOUR) ((HOUR) <= (uint8_t)12)
  520. #define IS_RTC_HOUR12_MIN(HOUR) ((HOUR) > (uint8_t)0)
  521. /**
  522. * @brief Macro used by the assert_param function in order to check the used
  523. * Calender Hours value (format 24h)
  524. */
  525. #define IS_RTC_HOUR24(HOUR) ((HOUR) <= 23)
  526. /**
  527. * @brief Macro used by the assert_param function in order to check the used
  528. * Calender minutes value
  529. */
  530. #define IS_RTC_MINUTES(MINUTES) ((MINUTES) <= 59)
  531. /**
  532. * @brief Macro used by the assert_param function in order to check the used
  533. * Calender seconds value
  534. */
  535. #define IS_RTC_SECONDS(SECONDS) ((SECONDS) <= 59)
  536. /**
  537. * @brief Macro used by the assert_param function in order to check the used
  538. * Calender H12 mode
  539. */
  540. #define IS_RTC_H12(PM) (((PM) == (RTC_H12_AM)) || ((PM) == (RTC_H12_PM)))
  541. /**
  542. * @brief Macro used by the assert_param function in order to check the used
  543. * Calender Year value
  544. */
  545. #define IS_RTC_YEAR(YEAR) ((YEAR) <= 99)
  546. /**
  547. * @brief Macro used by the assert_param function in order to check the used
  548. * Calender month value
  549. */
  550. #define IS_RTC_MONTH_MAX(MONTH) ((MONTH) <= (uint8_t)12)
  551. #define IS_RTC_MONTH_MIN(MONTH) ((MONTH) >= (uint8_t)1)
  552. /**
  553. * @brief Macro used by the assert_param function in order to check the used
  554. * Calender Date value
  555. */
  556. #define IS_RTC_DATE_MAX(DATE) ((DATE) <= (uint8_t)31)
  557. #define IS_RTC_DATE_MIN(DATE) ((DATE) >= (uint8_t)1)
  558. /**
  559. * @brief Macro used by the assert_param function in order to check the used
  560. * Calender Week day value
  561. */
  562. #define IS_RTC_WEEKDAY(WEEKDAY) (((WEEKDAY) == RTC_Weekday_Monday) || \
  563. ((WEEKDAY) == RTC_Weekday_Tuesday) || \
  564. ((WEEKDAY) == RTC_Weekday_Wednesday) || \
  565. ((WEEKDAY) == RTC_Weekday_Thursday) || \
  566. ((WEEKDAY) == RTC_Weekday_Friday) || \
  567. ((WEEKDAY) == RTC_Weekday_Saturday) || \
  568. ((WEEKDAY) == RTC_Weekday_Sunday))
  569. /**
  570. * @brief Macro used by the assert_param function in order to check the used
  571. * Alarm Date/week day selection
  572. */
  573. #define IS_RTC_ALARM_DATEWEEKDAY_SEL(SEL) (((SEL) == RTC_AlarmDateWeekDaySel_Date) || \
  574. ((SEL) == RTC_AlarmDateWeekDaySel_WeekDay))
  575. /**
  576. * @brief Macro used by the assert_param function in order to check the used
  577. * Alarm Mask
  578. */
  579. #define IS_RTC_ALARM_MASK(MASK) (((MASK) & 0x0F) == (uint8_t)(RESET))
  580. /**
  581. * @brief Macro used by the assert_param function in order to check the used
  582. * wakeup clock source
  583. */
  584. #define IS_RTC_WAKEUP_CLOCK(CLOCK) (((CLOCK) == RTC_WakeUpClock_RTCCLK_Div16) || \
  585. ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div8) || \
  586. ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div4) || \
  587. ((CLOCK) == RTC_WakeUpClock_RTCCLK_Div2) || \
  588. ((CLOCK) == RTC_WakeUpClock_CK_SPRE_16bits) || \
  589. ((CLOCK) == RTC_WakeUpClock_CK_SPRE_17bits))
  590. /**
  591. * @brief Macro used by the assert_param function in order to check the used
  592. * Output selection
  593. */
  594. #define IS_RTC_OUTPUT_SEL(SEL) (((SEL) == RTC_Output_Disable) || \
  595. ((SEL) == RTC_Output_Alarm) || \
  596. ((SEL) == RTC_Output_WakeUp))
  597. /**
  598. * @brief Macro used by the assert_param function in order to check the used
  599. * Output polarity
  600. */
  601. #define IS_RTC_OUTPUT_POL(POL) (((POL) == RTC_OutputPolarity_High) || \
  602. ((POL) == RTC_OutputPolarity_Low))
  603. /**
  604. * @brief Macro used by the assert_param function in order to check the used
  605. * Daylight saving mode
  606. */
  607. #define IS_RTC_DAYLIGHT_SAVING(SAVE) (((SAVE) == RTC_DayLightSaving_SUB1H) || \
  608. ((SAVE) == RTC_DayLightSaving_ADD1H))
  609. /**
  610. * @brief Macro used by the assert_param function in order to check the used
  611. * Store Operation status
  612. */
  613. #define IS_RTC_STORE_OPERATION(OP) (((OP) == RTC_StoreOperation_Set) || \
  614. ((OP) == RTC_StoreOperation_Reset))
  615. /**
  616. * @brief Macro used by the assert_param function in order to check the used
  617. * format (bin/bcd) for data user insert
  618. */
  619. #define IS_RTC_FORMAT(FORMAT) (((FORMAT) == RTC_Format_BIN) || \
  620. ((FORMAT) == RTC_Format_BCD))
  621. /**
  622. * @brief Macro used by the assert_param function in order to check the used
  623. * Flag to get
  624. */
  625. #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_WUTF) || \
  626. ((FLAG) == RTC_FLAG_ALRAF) || \
  627. ((FLAG) == RTC_FLAG_INITF) || \
  628. ((FLAG) == RTC_FLAG_RSF) || \
  629. ((FLAG) == RTC_FLAG_INITS) || \
  630. ((FLAG) == RTC_FLAG_WUTWF) || \
  631. ((FLAG) == RTC_FLAG_TAMP3F)|| \
  632. ((FLAG) == RTC_FLAG_TAMP2F)|| \
  633. ((FLAG) == RTC_FLAG_TAMP1F)|| \
  634. ((FLAG) == RTC_FLAG_SHPF) || \
  635. ((FLAG) == RTC_FLAG_RECALPF) || \
  636. ((FLAG) == RTC_FLAG_ALRAWF))
  637. /* RTC_FLAG_ALRAWF is for Medium Density only but supported by High Density
  638. Devices*/
  639. /**
  640. * @brief Macro used by the assert_param function in order to check the used
  641. * Flag to clear
  642. */
  643. #define RTC_FLAG_CLRBLE (RTC_FLAG_RSF | RTC_FLAG_ALRAF | RTC_FLAG_WUTF| RTC_FLAG_TAMP1F|RTC_FLAG_TAMP2F|RTC_FLAG_TAMP3F)
  644. #define IS_RTC_CLEAR_FLAG(FLAG) (((FLAG) != RESET) && ((uint16_t)((FLAG) & (uint16_t)(~(RTC_FLAG_CLRBLE))) == RESET))
  645. /**
  646. * @brief Macro used by the assert_param function in order to check the used
  647. * Interrupt to configure
  648. */
  649. #define IS_RTC_CONFIG_IT(IT) (((uint16_t)(IT) != (uint8_t)RESET) && ((uint16_t)((uint16_t)(IT) & (uint16_t)(~(uint16_t)(RTC_IT_WUT|RTC_IT_ALRA|RTC_IT_TAMP))) == (uint8_t)RESET))
  650. /**
  651. * @brief Macro used by the assert_param function in order to check the used
  652. * Interrupt to get
  653. */
  654. #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_WUT) || \
  655. ((IT) == RTC_IT_ALRA)|| \
  656. ((IT) == RTC_IT_TAMP) )
  657. /**
  658. * @brief Macro used by the assert_param function in order to check the used
  659. * Interrupt to clear
  660. */
  661. #define IS_RTC_CLEAR_IT(IT) (((IT) != RESET) && ((uint16_t)((IT) & (uint16_t)(~(uint16_t)(RTC_IT_WUT|RTC_IT_ALRA|RTC_IT_TAMP))) == RESET))
  662. /**
  663. * @brief Macro used by the assert_param function in order to check the used
  664. * Tamper Levels
  665. */
  666. #define IS_RTC_TAMPER_LEVEL(LEVEL) (((LEVEL) == RTC_TamperLevel_Low) || \
  667. ((LEVEL) == RTC_TamperLevel_High))
  668. /**
  669. * @brief Macro used by the assert_param function in order to check the used
  670. * Tamper
  671. */
  672. #define NOT_CORRECT_TAMPER (uint8_t)~(uint8_t)( RTC_Tamper_1 | \
  673. RTC_Tamper_2 | \
  674. RTC_Tamper_3)
  675. #define IS_RTC_TAMPER(TAMPER) (((uint8_t)((TAMPER) & NOT_CORRECT_TAMPER) == RESET) && ((TAMPER) != RESET))
  676. /**
  677. * @brief Macro used by the assert_param function in order to check the used
  678. * Tampers Filter
  679. */
  680. #define IS_RTC_TAMPER_FILTER(SEL) (((SEL) == RTC_TamperFilter_1Sample) || \
  681. ((SEL) == RTC_TamperFilter_2Sample) || \
  682. ((SEL) == RTC_TamperFilter_4Sample) || \
  683. ((SEL) == RTC_TamperFilter_8Sample))
  684. /**
  685. * @brief Macro used by the assert_param function in order to check the used
  686. * Tampers Sampling Frequencies
  687. */
  688. #define IS_RTC_TAMPER_SAMPLING_FREQ(SEL) ((SEL) <= RTC_TamperSamplingFreq_RTCCLK_Div256)
  689. /**
  690. * @brief Macro used by the assert_param function in order to check the used
  691. * Tampers Pins precharge duration
  692. */
  693. #define IS_RTC_TAMPER_PINS_PRECHAR_DURATION(SEL) (((SEL) == RTC_TamperPrechargeDuration_None) || \
  694. ((SEL) == RTC_TamperPrechargeDuration_1RTCCLK) || \
  695. ((SEL) == RTC_TamperPrechargeDuration_2RTCCLK) || \
  696. ((SEL) == RTC_TamperPrechargeDuration_4RTCCLK) || \
  697. ((SEL) == RTC_TamperPrechargeDuration_8RTCCLK))
  698. /**
  699. * @brief Macro used by the assert_param function in order to check the used
  700. * Smooth calibration period
  701. */
  702. #define IS_RTC_SMOOTH_CALIB_PERIOD(SEL) (((SEL) == RTC_SmoothCalibPeriod_32sec) || \
  703. ((SEL) == RTC_SmoothCalibPeriod_16sec) || \
  704. ((SEL) == RTC_SmoothCalibPeriod_8sec))
  705. /**
  706. * @brief Macro used by the assert_param function in order to check the used
  707. * Smooth calibration Plus pulses
  708. */
  709. #define IS_RTC_SMOOTH_CALIB_PLUS(SEL) (((SEL) == RTC_SmoothCalibPlusPulses_Set) || \
  710. ((SEL) == RTC_SmoothCalibPlusPulses_Reset))
  711. /**
  712. * @brief Macro used by the assert_param function in order to check the used
  713. * Smooth calibration Minus pulses
  714. */
  715. #define IS_RTC_SMOOTH_CALIB_MINUS(VALUE) ((VALUE) <= 0x01FF)
  716. /**
  717. * @brief Macro used by the assert_param function in order to check the used
  718. * Output Selection
  719. */
  720. #define IS_RTC_OUTPUT_SELECT(SEL) (((SEL) == RTC_Output_Disable) || \
  721. ((SEL) == RTC_Output_Alarm) || \
  722. ((SEL) == RTC_Output_WakeUp))
  723. /**
  724. * @brief Macro used by the assert_param function in order to check the
  725. * used calibration Output Selection
  726. */
  727. #define IS_RTC_CALOUTPUT_SELECT(SEL) (((SEL) == RTC_CalibOutput_512Hz) || \
  728. ((SEL) == RTC_CalibOutput_1Hz))
  729. /**
  730. * @brief Macro used by the assert_param function in order to check the used
  731. * Alarm sub second value
  732. */
  733. #define IS_RTC_ALARM_SS_VALUE(SS) ((SS) <= 0x7FFF)
  734. /**
  735. * @brief Macro used by the assert_param function in order to check the used
  736. * Alarm sub second mask
  737. */
  738. #define IS_RTC_ALARM_SS_MASK(MASK) ((MASK) <= 0x0F)
  739. /**
  740. * @brief Macro used by the assert_param function in order to check the used
  741. * fraction of seconds to sub
  742. */
  743. #define IS_RTC_SHIFT_SUBFS(FS) ((FS) <= 0x7FFF)
  744. /**
  745. * @brief Macro used by the assert_param function in order to check the
  746. * parameter of 1 second to add
  747. */
  748. #define IS_RTC_SHIFT_ADD1S(VAL) (((VAL) == RTC_ShiftAdd1S_Set) || \
  749. ((VAL) == RTC_ShiftAdd1S_Reset))
  750. /**
  751. * @}
  752. */
  753. /* Exported functions ------------------------------------------------------- */
  754. /* Function used to set the RTC configuration to the default reset state *****/
  755. ErrorStatus RTC_DeInit(void);
  756. /* Initialization and Configuration functions *********************************/
  757. ErrorStatus RTC_Init(RTC_InitTypeDef* RTC_InitStruct);
  758. void RTC_StructInit(RTC_InitTypeDef* RTC_InitStruct);
  759. void RTC_WriteProtectionCmd(FunctionalState NewState);
  760. ErrorStatus RTC_EnterInitMode(void);
  761. void RTC_ExitInitMode(void);
  762. ErrorStatus RTC_WaitForSynchro(void);
  763. void RTC_RatioCmd(FunctionalState NewState);
  764. void RTC_BypassShadowCmd(FunctionalState NewState);
  765. /* Time and Date configuration functions **************************************/
  766. ErrorStatus RTC_SetTime(RTC_Format_TypeDef RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct);
  767. void RTC_TimeStructInit(RTC_TimeTypeDef* RTC_TimeStruct);
  768. void RTC_GetTime(RTC_Format_TypeDef RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct);
  769. uint16_t RTC_GetSubSecond(void);
  770. ErrorStatus RTC_SetDate(RTC_Format_TypeDef RTC_Format, RTC_DateTypeDef* RTC_DateStruct);
  771. void RTC_DateStructInit(RTC_DateTypeDef* RTC_DateStruct);
  772. void RTC_GetDate(RTC_Format_TypeDef RTC_Format, RTC_DateTypeDef* RTC_DateStruct);
  773. /* Alarm configuration functions *********************************************/
  774. void RTC_SetAlarm(RTC_Format_TypeDef RTC_Format, RTC_AlarmTypeDef* RTC_AlarmStruct);
  775. void RTC_AlarmStructInit(RTC_AlarmTypeDef* RTC_AlarmStruct);
  776. void RTC_GetAlarm(RTC_Format_TypeDef RTC_Format, RTC_AlarmTypeDef* RTC_AlarmStruct);
  777. ErrorStatus RTC_AlarmCmd(FunctionalState NewState);
  778. ErrorStatus RTC_AlarmSubSecondConfig(uint16_t RTC_AlarmSubSecondValue,
  779. RTC_AlarmSubSecondMask_TypeDef RTC_AlarmSubSecondMask);
  780. /* WakeUp Timer configuration functions ***************************************/
  781. void RTC_WakeUpClockConfig(RTC_WakeUpClock_TypeDef RTC_WakeUpClock);
  782. void RTC_SetWakeUpCounter(uint16_t RTC_WakeupCounter);
  783. uint16_t RTC_GetWakeUpCounter(void);
  784. ErrorStatus RTC_WakeUpCmd(FunctionalState NewState);
  785. /* Daylight Saving configuration functions ************************************/
  786. void RTC_DayLightSavingConfig(RTC_DayLightSaving_TypeDef RTC_DayLightSaving,
  787. RTC_StoreOperation_TypeDef RTC_StoreOperation);
  788. RTC_StoreOperation_TypeDef RTC_GetStoreOperation(void);
  789. /* Output pin Configuration function ******************************************/
  790. void RTC_OutputConfig(RTC_Output_TypeDef RTC_Output,
  791. RTC_OutputPolarity_TypeDef RTC_OutputPolarity);
  792. /* Shift control synchronisation function ************************************/
  793. ErrorStatus RTC_SynchroShiftConfig(RTC_ShiftAdd1S_TypeDef RTC_ShiftAdd1S,
  794. uint16_t RTC_ShiftSubFS);
  795. /* Smooth Calibration functions **********************************************/
  796. ErrorStatus RTC_SmoothCalibConfig(RTC_SmoothCalibPeriod_TypeDef RTC_SmoothCalibPeriod,
  797. RTC_SmoothCalibPlusPulses_TypeDef RTC_SmoothCalibPlusPulses,
  798. uint16_t RTC_SmouthCalibMinusPulsesValue);
  799. /* Calibration configuration functions ****************************************/
  800. void RTC_CalibOutputConfig(RTC_CalibOutput_TypeDef RTC_CalibOutput);
  801. void RTC_CalibOutputCmd(FunctionalState NewState);
  802. /* Tampers configuration functions ********************************************/
  803. void RTC_TamperLevelConfig(RTC_Tamper_TypeDef RTC_Tamper,
  804. RTC_TamperLevel_TypeDef RTC_TamperLevel);
  805. void RTC_TamperFilterConfig(RTC_TamperFilter_TypeDef RTC_TamperFilter);
  806. void RTC_TamperSamplingFreqConfig(RTC_TamperSamplingFreq_TypeDef RTC_TamperSamplingFreq);
  807. void RTC_TamperPinsPrechargeDuration(RTC_TamperPrechargeDuration_TypeDef RTC_TamperPrechargeDuration);
  808. void RTC_TamperCmd(RTC_Tamper_TypeDef RTC_Tamper,
  809. FunctionalState NewState);
  810. /* Interrupts and flags management functions **********************************/
  811. void RTC_ITConfig(RTC_IT_TypeDef RTC_IT, FunctionalState NewState);
  812. FlagStatus RTC_GetFlagStatus(RTC_Flag_TypeDef RTC_FLAG);
  813. void RTC_ClearFlag(RTC_Flag_TypeDef RTC_FLAG);
  814. ITStatus RTC_GetITStatus(RTC_IT_TypeDef RTC_IT);
  815. void RTC_ClearITPendingBit(RTC_IT_TypeDef RTC_IT);
  816. #endif /*__STM8L15x_RTC_H */
  817. /**
  818. * @}
  819. */
  820. /**
  821. * @}
  822. */
  823. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/