stm32f4xx_hal_lptim.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_hal_lptim.h
  4. * @author MCD Application Team
  5. * @brief Header file of LPTIM HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2016 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_LPTIM_H
  21. #define STM32F4xx_HAL_LPTIM_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. #if defined (LPTIM1)
  31. /** @addtogroup LPTIM
  32. * @{
  33. */
  34. /* Exported types ------------------------------------------------------------*/
  35. /** @defgroup LPTIM_Exported_Types LPTIM Exported Types
  36. * @{
  37. */
  38. #define LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT EXTI_IMR_MR23 /*!< External interrupt line 23 Connected to the LPTIM EXTI Line */
  39. /**
  40. * @brief LPTIM Clock configuration definition
  41. */
  42. typedef struct
  43. {
  44. uint32_t Source; /*!< Selects the clock source.
  45. This parameter can be a value of @ref LPTIM_Clock_Source */
  46. uint32_t Prescaler; /*!< Specifies the counter clock Prescaler.
  47. This parameter can be a value of @ref LPTIM_Clock_Prescaler */
  48. } LPTIM_ClockConfigTypeDef;
  49. /**
  50. * @brief LPTIM Clock configuration definition
  51. */
  52. typedef struct
  53. {
  54. uint32_t Polarity; /*!< Selects the polarity of the active edge for the counter unit
  55. if the ULPTIM input is selected.
  56. Note: This parameter is used only when Ultra low power clock source is used.
  57. Note: If the polarity is configured on 'both edges', an auxiliary clock
  58. (one of the Low power oscillator) must be active.
  59. This parameter can be a value of @ref LPTIM_Clock_Polarity */
  60. uint32_t SampleTime; /*!< Selects the clock sampling time to configure the clock glitch filter.
  61. Note: This parameter is used only when Ultra low power clock source is used.
  62. This parameter can be a value of @ref LPTIM_Clock_Sample_Time */
  63. } LPTIM_ULPClockConfigTypeDef;
  64. /**
  65. * @brief LPTIM Trigger configuration definition
  66. */
  67. typedef struct
  68. {
  69. uint32_t Source; /*!< Selects the Trigger source.
  70. This parameter can be a value of @ref LPTIM_Trigger_Source */
  71. uint32_t ActiveEdge; /*!< Selects the Trigger active edge.
  72. Note: This parameter is used only when an external trigger is used.
  73. This parameter can be a value of @ref LPTIM_External_Trigger_Polarity */
  74. uint32_t SampleTime; /*!< Selects the trigger sampling time to configure the clock glitch filter.
  75. Note: This parameter is used only when an external trigger is used.
  76. This parameter can be a value of @ref LPTIM_Trigger_Sample_Time */
  77. } LPTIM_TriggerConfigTypeDef;
  78. /**
  79. * @brief LPTIM Initialization Structure definition
  80. */
  81. typedef struct
  82. {
  83. LPTIM_ClockConfigTypeDef Clock; /*!< Specifies the clock parameters */
  84. LPTIM_ULPClockConfigTypeDef UltraLowPowerClock; /*!< Specifies the Ultra Low Power clock parameters */
  85. LPTIM_TriggerConfigTypeDef Trigger; /*!< Specifies the Trigger parameters */
  86. uint32_t OutputPolarity; /*!< Specifies the Output polarity.
  87. This parameter can be a value of @ref LPTIM_Output_Polarity */
  88. uint32_t UpdateMode; /*!< Specifies whether the update of the autoreload and the compare
  89. values is done immediately or after the end of current period.
  90. This parameter can be a value of @ref LPTIM_Updating_Mode */
  91. uint32_t CounterSource; /*!< Specifies whether the counter is incremented each internal event
  92. or each external event.
  93. This parameter can be a value of @ref LPTIM_Counter_Source */
  94. } LPTIM_InitTypeDef;
  95. /**
  96. * @brief HAL LPTIM State structure definition
  97. */
  98. typedef enum
  99. {
  100. HAL_LPTIM_STATE_RESET = 0x00U, /*!< Peripheral not yet initialized or disabled */
  101. HAL_LPTIM_STATE_READY = 0x01U, /*!< Peripheral Initialized and ready for use */
  102. HAL_LPTIM_STATE_BUSY = 0x02U, /*!< An internal process is ongoing */
  103. HAL_LPTIM_STATE_TIMEOUT = 0x03U, /*!< Timeout state */
  104. HAL_LPTIM_STATE_ERROR = 0x04U /*!< Internal Process is ongoing */
  105. } HAL_LPTIM_StateTypeDef;
  106. /**
  107. * @brief LPTIM handle Structure definition
  108. */
  109. #if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1)
  110. typedef struct __LPTIM_HandleTypeDef
  111. #else
  112. typedef struct
  113. #endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */
  114. {
  115. LPTIM_TypeDef *Instance; /*!< Register base address */
  116. LPTIM_InitTypeDef Init; /*!< LPTIM required parameters */
  117. HAL_StatusTypeDef Status; /*!< LPTIM peripheral status */
  118. HAL_LockTypeDef Lock; /*!< LPTIM locking object */
  119. __IO HAL_LPTIM_StateTypeDef State; /*!< LPTIM peripheral state */
  120. #if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1)
  121. void (* MspInitCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< LPTIM Base Msp Init Callback */
  122. void (* MspDeInitCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< LPTIM Base Msp DeInit Callback */
  123. void (* CompareMatchCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< Compare match Callback */
  124. void (* AutoReloadMatchCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< Auto-reload match Callback */
  125. void (* TriggerCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< External trigger event detection Callback */
  126. void (* CompareWriteCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< Compare register write complete Callback */
  127. void (* AutoReloadWriteCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< Auto-reload register write complete Callback */
  128. void (* DirectionUpCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< Up-counting direction change Callback */
  129. void (* DirectionDownCallback)(struct __LPTIM_HandleTypeDef *hlptim); /*!< Down-counting direction change Callback */
  130. #endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */
  131. } LPTIM_HandleTypeDef;
  132. #if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1)
  133. /**
  134. * @brief HAL LPTIM Callback ID enumeration definition
  135. */
  136. typedef enum
  137. {
  138. HAL_LPTIM_MSPINIT_CB_ID = 0x00U, /*!< LPTIM Base Msp Init Callback ID */
  139. HAL_LPTIM_MSPDEINIT_CB_ID = 0x01U, /*!< LPTIM Base Msp DeInit Callback ID */
  140. HAL_LPTIM_COMPARE_MATCH_CB_ID = 0x02U, /*!< Compare match Callback ID */
  141. HAL_LPTIM_AUTORELOAD_MATCH_CB_ID = 0x03U, /*!< Auto-reload match Callback ID */
  142. HAL_LPTIM_TRIGGER_CB_ID = 0x04U, /*!< External trigger event detection Callback ID */
  143. HAL_LPTIM_COMPARE_WRITE_CB_ID = 0x05U, /*!< Compare register write complete Callback ID */
  144. HAL_LPTIM_AUTORELOAD_WRITE_CB_ID = 0x06U, /*!< Auto-reload register write complete Callback ID */
  145. HAL_LPTIM_DIRECTION_UP_CB_ID = 0x07U, /*!< Up-counting direction change Callback ID */
  146. HAL_LPTIM_DIRECTION_DOWN_CB_ID = 0x08U, /*!< Down-counting direction change Callback ID */
  147. } HAL_LPTIM_CallbackIDTypeDef;
  148. /**
  149. * @brief HAL TIM Callback pointer definition
  150. */
  151. typedef void (*pLPTIM_CallbackTypeDef)(LPTIM_HandleTypeDef *hlptim); /*!< pointer to the LPTIM callback function */
  152. #endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */
  153. /**
  154. * @}
  155. */
  156. /* Exported constants --------------------------------------------------------*/
  157. /** @defgroup LPTIM_Exported_Constants LPTIM Exported Constants
  158. * @{
  159. */
  160. /** @defgroup LPTIM_Clock_Source LPTIM Clock Source
  161. * @{
  162. */
  163. #define LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC 0x00000000U
  164. #define LPTIM_CLOCKSOURCE_ULPTIM LPTIM_CFGR_CKSEL
  165. /**
  166. * @}
  167. */
  168. /** @defgroup LPTIM_Clock_Prescaler LPTIM Clock Prescaler
  169. * @{
  170. */
  171. #define LPTIM_PRESCALER_DIV1 0x00000000U
  172. #define LPTIM_PRESCALER_DIV2 LPTIM_CFGR_PRESC_0
  173. #define LPTIM_PRESCALER_DIV4 LPTIM_CFGR_PRESC_1
  174. #define LPTIM_PRESCALER_DIV8 (LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_1)
  175. #define LPTIM_PRESCALER_DIV16 LPTIM_CFGR_PRESC_2
  176. #define LPTIM_PRESCALER_DIV32 (LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_2)
  177. #define LPTIM_PRESCALER_DIV64 (LPTIM_CFGR_PRESC_1 | LPTIM_CFGR_PRESC_2)
  178. #define LPTIM_PRESCALER_DIV128 LPTIM_CFGR_PRESC
  179. /**
  180. * @}
  181. */
  182. /** @defgroup LPTIM_Output_Polarity LPTIM Output Polarity
  183. * @{
  184. */
  185. #define LPTIM_OUTPUTPOLARITY_HIGH 0x00000000U
  186. #define LPTIM_OUTPUTPOLARITY_LOW LPTIM_CFGR_WAVPOL
  187. /**
  188. * @}
  189. */
  190. /** @defgroup LPTIM_Clock_Sample_Time LPTIM Clock Sample Time
  191. * @{
  192. */
  193. #define LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION 0x00000000U
  194. #define LPTIM_CLOCKSAMPLETIME_2TRANSITIONS LPTIM_CFGR_CKFLT_0
  195. #define LPTIM_CLOCKSAMPLETIME_4TRANSITIONS LPTIM_CFGR_CKFLT_1
  196. #define LPTIM_CLOCKSAMPLETIME_8TRANSITIONS LPTIM_CFGR_CKFLT
  197. /**
  198. * @}
  199. */
  200. /** @defgroup LPTIM_Clock_Polarity LPTIM Clock Polarity
  201. * @{
  202. */
  203. #define LPTIM_CLOCKPOLARITY_RISING 0x00000000U
  204. #define LPTIM_CLOCKPOLARITY_FALLING LPTIM_CFGR_CKPOL_0
  205. #define LPTIM_CLOCKPOLARITY_RISING_FALLING LPTIM_CFGR_CKPOL_1
  206. /**
  207. * @}
  208. */
  209. /** @defgroup LPTIM_Trigger_Source LPTIM Trigger Source
  210. * @{
  211. */
  212. #define LPTIM_TRIGSOURCE_SOFTWARE 0x0000FFFFU
  213. #define LPTIM_TRIGSOURCE_0 0x00000000U
  214. #define LPTIM_TRIGSOURCE_1 LPTIM_CFGR_TRIGSEL_0
  215. #define LPTIM_TRIGSOURCE_2 LPTIM_CFGR_TRIGSEL_1
  216. #define LPTIM_TRIGSOURCE_3 (LPTIM_CFGR_TRIGSEL_0 | LPTIM_CFGR_TRIGSEL_1)
  217. #define LPTIM_TRIGSOURCE_4 LPTIM_CFGR_TRIGSEL_2
  218. #define LPTIM_TRIGSOURCE_5 (LPTIM_CFGR_TRIGSEL_0 | LPTIM_CFGR_TRIGSEL_2)
  219. /**
  220. * @}
  221. */
  222. /** @defgroup LPTIM_External_Trigger_Polarity LPTIM External Trigger Polarity
  223. * @{
  224. */
  225. #define LPTIM_ACTIVEEDGE_RISING LPTIM_CFGR_TRIGEN_0
  226. #define LPTIM_ACTIVEEDGE_FALLING LPTIM_CFGR_TRIGEN_1
  227. #define LPTIM_ACTIVEEDGE_RISING_FALLING LPTIM_CFGR_TRIGEN
  228. /**
  229. * @}
  230. */
  231. /** @defgroup LPTIM_Trigger_Sample_Time LPTIM Trigger Sample Time
  232. * @{
  233. */
  234. #define LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION 0x00000000U
  235. #define LPTIM_TRIGSAMPLETIME_2TRANSITIONS LPTIM_CFGR_TRGFLT_0
  236. #define LPTIM_TRIGSAMPLETIME_4TRANSITIONS LPTIM_CFGR_TRGFLT_1
  237. #define LPTIM_TRIGSAMPLETIME_8TRANSITIONS LPTIM_CFGR_TRGFLT
  238. /**
  239. * @}
  240. */
  241. /** @defgroup LPTIM_Updating_Mode LPTIM Updating Mode
  242. * @{
  243. */
  244. #define LPTIM_UPDATE_IMMEDIATE 0x00000000U
  245. #define LPTIM_UPDATE_ENDOFPERIOD LPTIM_CFGR_PRELOAD
  246. /**
  247. * @}
  248. */
  249. /** @defgroup LPTIM_Counter_Source LPTIM Counter Source
  250. * @{
  251. */
  252. #define LPTIM_COUNTERSOURCE_INTERNAL 0x00000000U
  253. #define LPTIM_COUNTERSOURCE_EXTERNAL LPTIM_CFGR_COUNTMODE
  254. /**
  255. * @}
  256. */
  257. /** @defgroup LPTIM_Flag_Definition LPTIM Flags Definition
  258. * @{
  259. */
  260. #define LPTIM_FLAG_DOWN LPTIM_ISR_DOWN
  261. #define LPTIM_FLAG_UP LPTIM_ISR_UP
  262. #define LPTIM_FLAG_ARROK LPTIM_ISR_ARROK
  263. #define LPTIM_FLAG_CMPOK LPTIM_ISR_CMPOK
  264. #define LPTIM_FLAG_EXTTRIG LPTIM_ISR_EXTTRIG
  265. #define LPTIM_FLAG_ARRM LPTIM_ISR_ARRM
  266. #define LPTIM_FLAG_CMPM LPTIM_ISR_CMPM
  267. /**
  268. * @}
  269. */
  270. /** @defgroup LPTIM_Interrupts_Definition LPTIM Interrupts Definition
  271. * @{
  272. */
  273. #define LPTIM_IT_DOWN LPTIM_IER_DOWNIE
  274. #define LPTIM_IT_UP LPTIM_IER_UPIE
  275. #define LPTIM_IT_ARROK LPTIM_IER_ARROKIE
  276. #define LPTIM_IT_CMPOK LPTIM_IER_CMPOKIE
  277. #define LPTIM_IT_EXTTRIG LPTIM_IER_EXTTRIGIE
  278. #define LPTIM_IT_ARRM LPTIM_IER_ARRMIE
  279. #define LPTIM_IT_CMPM LPTIM_IER_CMPMIE
  280. /**
  281. * @}
  282. */
  283. /** @defgroup LPTIM_Option Register Definition
  284. * @{
  285. */
  286. #define LPTIM_OP_PAD_AF 0x00000000U
  287. #define LPTIM_OP_PAD_PA4 LPTIM_OR_LPT_IN1_RMP_0
  288. #define LPTIM_OP_PAD_PB9 LPTIM_OR_LPT_IN1_RMP_1
  289. #define LPTIM_OP_TIM_DAC LPTIM_OR_LPT_IN1_RMP
  290. /**
  291. * @}
  292. */
  293. /**
  294. * @}
  295. */
  296. /* Exported macros -----------------------------------------------------------*/
  297. /** @defgroup LPTIM_Exported_Macros LPTIM Exported Macros
  298. * @{
  299. */
  300. /** @brief Reset LPTIM handle state.
  301. * @param __HANDLE__ LPTIM handle
  302. * @retval None
  303. */
  304. #if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1)
  305. #define __HAL_LPTIM_RESET_HANDLE_STATE(__HANDLE__) do { \
  306. (__HANDLE__)->State = HAL_LPTIM_STATE_RESET; \
  307. (__HANDLE__)->MspInitCallback = NULL; \
  308. (__HANDLE__)->MspDeInitCallback = NULL; \
  309. } while(0)
  310. #else
  311. #define __HAL_LPTIM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LPTIM_STATE_RESET)
  312. #endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */
  313. /**
  314. * @brief Enable the LPTIM peripheral.
  315. * @param __HANDLE__ LPTIM handle
  316. * @retval None
  317. */
  318. #define __HAL_LPTIM_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (LPTIM_CR_ENABLE))
  319. /**
  320. * @brief Disable the LPTIM peripheral.
  321. * @param __HANDLE__ LPTIM handle
  322. * @note The following sequence is required to solve LPTIM disable HW limitation.
  323. * Please check Errata Sheet ES0335 for more details under "MCU may remain
  324. * stuck in LPTIM interrupt when entering Stop mode" section.
  325. * @note Please call @ref HAL_LPTIM_GetState() after a call to __HAL_LPTIM_DISABLE to
  326. * check for TIMEOUT.
  327. * @retval None
  328. */
  329. #define __HAL_LPTIM_DISABLE(__HANDLE__) LPTIM_Disable(__HANDLE__)
  330. /**
  331. * @brief Start the LPTIM peripheral in Continuous mode.
  332. * @param __HANDLE__ LPTIM handle
  333. * @retval None
  334. */
  335. #define __HAL_LPTIM_START_CONTINUOUS(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_CNTSTRT)
  336. /**
  337. * @brief Start the LPTIM peripheral in single mode.
  338. * @param __HANDLE__ LPTIM handle
  339. * @retval None
  340. */
  341. #define __HAL_LPTIM_START_SINGLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_SNGSTRT)
  342. /**
  343. * @brief Write the passed parameter in the Autoreload register.
  344. * @param __HANDLE__ LPTIM handle
  345. * @param __VALUE__ Autoreload value
  346. * @retval None
  347. * @note The ARR register can only be modified when the LPTIM instance is enabled.
  348. */
  349. #define __HAL_LPTIM_AUTORELOAD_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->ARR = (__VALUE__))
  350. /**
  351. * @brief Write the passed parameter in the Compare register.
  352. * @param __HANDLE__ LPTIM handle
  353. * @param __VALUE__ Compare value
  354. * @retval None
  355. * @note The CMP register can only be modified when the LPTIM instance is enabled.
  356. */
  357. #define __HAL_LPTIM_COMPARE_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->CMP = (__VALUE__))
  358. /**
  359. * @brief Check whether the specified LPTIM flag is set or not.
  360. * @param __HANDLE__ LPTIM handle
  361. * @param __FLAG__ LPTIM flag to check
  362. * This parameter can be a value of:
  363. * @arg LPTIM_FLAG_DOWN : Counter direction change up Flag.
  364. * @arg LPTIM_FLAG_UP : Counter direction change down to up Flag.
  365. * @arg LPTIM_FLAG_ARROK : Autoreload register update OK Flag.
  366. * @arg LPTIM_FLAG_CMPOK : Compare register update OK Flag.
  367. * @arg LPTIM_FLAG_EXTTRIG : External trigger edge event Flag.
  368. * @arg LPTIM_FLAG_ARRM : Autoreload match Flag.
  369. * @arg LPTIM_FLAG_CMPM : Compare match Flag.
  370. * @retval The state of the specified flag (SET or RESET).
  371. */
  372. #define __HAL_LPTIM_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR &(__FLAG__)) == (__FLAG__))
  373. /**
  374. * @brief Clear the specified LPTIM flag.
  375. * @param __HANDLE__ LPTIM handle.
  376. * @param __FLAG__ LPTIM flag to clear.
  377. * This parameter can be a value of:
  378. * @arg LPTIM_FLAG_DOWN : Counter direction change up Flag.
  379. * @arg LPTIM_FLAG_UP : Counter direction change down to up Flag.
  380. * @arg LPTIM_FLAG_ARROK : Autoreload register update OK Flag.
  381. * @arg LPTIM_FLAG_CMPOK : Compare register update OK Flag.
  382. * @arg LPTIM_FLAG_EXTTRIG : External trigger edge event Flag.
  383. * @arg LPTIM_FLAG_ARRM : Autoreload match Flag.
  384. * @arg LPTIM_FLAG_CMPM : Compare match Flag.
  385. * @retval None.
  386. */
  387. #define __HAL_LPTIM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
  388. /**
  389. * @brief Enable the specified LPTIM interrupt.
  390. * @param __HANDLE__ LPTIM handle.
  391. * @param __INTERRUPT__ LPTIM interrupt to set.
  392. * This parameter can be a value of:
  393. * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt.
  394. * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt.
  395. * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt.
  396. * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt.
  397. * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt.
  398. * @arg LPTIM_IT_ARRM : Autoreload match Interrupt.
  399. * @arg LPTIM_IT_CMPM : Compare match Interrupt.
  400. * @retval None.
  401. * @note The LPTIM interrupts can only be enabled when the LPTIM instance is disabled.
  402. */
  403. #define __HAL_LPTIM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
  404. /**
  405. * @brief Disable the specified LPTIM interrupt.
  406. * @param __HANDLE__ LPTIM handle.
  407. * @param __INTERRUPT__ LPTIM interrupt to set.
  408. * This parameter can be a value of:
  409. * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt.
  410. * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt.
  411. * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt.
  412. * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt.
  413. * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt.
  414. * @arg LPTIM_IT_ARRM : Autoreload match Interrupt.
  415. * @arg LPTIM_IT_CMPM : Compare match Interrupt.
  416. * @retval None.
  417. * @note The LPTIM interrupts can only be disabled when the LPTIM instance is disabled.
  418. */
  419. #define __HAL_LPTIM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (~(__INTERRUPT__)))
  420. /**
  421. * @brief Check whether the specified LPTIM interrupt source is enabled or not.
  422. * @param __HANDLE__ LPTIM handle.
  423. * @param __INTERRUPT__ LPTIM interrupt to check.
  424. * This parameter can be a value of:
  425. * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt.
  426. * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt.
  427. * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt.
  428. * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt.
  429. * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt.
  430. * @arg LPTIM_IT_ARRM : Autoreload match Interrupt.
  431. * @arg LPTIM_IT_CMPM : Compare match Interrupt.
  432. * @retval Interrupt status.
  433. */
  434. #define __HAL_LPTIM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER\
  435. & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
  436. /** @brief LPTIM Option Register
  437. * @param __HANDLE__ LPTIM handle
  438. * @param __VALUE__ This parameter can be a value of :
  439. * @arg LPTIM_OP_PAD_AF
  440. * @arg LPTIM_OP_PAD_PA4
  441. * @arg LPTIM_OP_PAD_PB9
  442. * @arg LPTIM_OP_TIM_DAC
  443. * @retval None
  444. */
  445. #define __HAL_LPTIM_OPTR_CONFIG(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->OR = (__VALUE__))
  446. /**
  447. * @brief Enable interrupt on the LPTIM Wake-up Timer associated Exti line.
  448. * @retval None
  449. */
  450. #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_IT() (EXTI->IMR\
  451. |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)
  452. /**
  453. * @brief Disable interrupt on the LPTIM Wake-up Timer associated Exti line.
  454. * @retval None
  455. */
  456. #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_IT() (EXTI->IMR\
  457. &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT))
  458. /**
  459. * @brief Enable event on the LPTIM Wake-up Timer associated Exti line.
  460. * @retval None.
  461. */
  462. #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_EVENT() (EXTI->EMR\
  463. |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)
  464. /**
  465. * @brief Disable event on the LPTIM Wake-up Timer associated Exti line.
  466. * @retval None.
  467. */
  468. #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_EVENT() (EXTI->EMR\
  469. &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT))
  470. #if defined(EXTI_IMR_MR23)
  471. /**
  472. * @brief Enable falling edge trigger on the LPTIM Wake-up Timer associated Exti line.
  473. * @retval None.
  474. */
  475. #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE() (EXTI->FTSR\
  476. |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)
  477. /**
  478. * @brief Disable falling edge trigger on the LPTIM Wake-up Timer associated Exti line.
  479. * @retval None.
  480. */
  481. #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE() (EXTI->FTSR\
  482. &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT))
  483. /**
  484. * @brief Enable rising edge trigger on the LPTIM Wake-up Timer associated Exti line.
  485. * @retval None.
  486. */
  487. #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE() (EXTI->RTSR\
  488. |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)
  489. /**
  490. * @brief Disable rising edge trigger on the LPTIM Wake-up Timer associated Exti line.
  491. * @retval None.
  492. */
  493. #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE() (EXTI->RTSR\
  494. &= ~(LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT))
  495. /**
  496. * @brief Enable rising & falling edge trigger on the LPTIM Wake-up Timer associated Exti line.
  497. * @retval None.
  498. */
  499. #define __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_RISING_FALLING_EDGE() do{__HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_RISING_EDGE();\
  500. __HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_FALLING_EDGE();\
  501. }while(0)
  502. /**
  503. * @brief Disable rising & falling edge trigger on the LPTIM Wake-up Timer associated Exti line.
  504. * @retval None.
  505. */
  506. #define __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_RISING_FALLING_EDGE() do{__HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_RISING_EDGE();\
  507. __HAL_LPTIM_WAKEUPTIMER_EXTI_DISABLE_FALLING_EDGE();\
  508. }while(0)
  509. /**
  510. * @brief Check whether the LPTIM Wake-up Timer associated Exti line interrupt flag is set or not.
  511. * @retval Line Status.
  512. */
  513. #define __HAL_LPTIM_WAKEUPTIMER_EXTI_GET_FLAG() (EXTI->PR\
  514. & LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)
  515. /**
  516. * @brief Clear the LPTIM Wake-up Timer associated Exti line flag.
  517. * @retval None.
  518. */
  519. #define __HAL_LPTIM_WAKEUPTIMER_EXTI_CLEAR_FLAG() (EXTI->PR\
  520. = LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)
  521. /**
  522. * @brief Generate a Software interrupt on the LPTIM Wake-up Timer associated Exti line.
  523. * @retval None.
  524. */
  525. #define __HAL_LPTIM_WAKEUPTIMER_EXTI_GENERATE_SWIT() (EXTI->SWIER\
  526. |= LPTIM_EXTI_LINE_WAKEUPTIMER_EVENT)
  527. #endif /* EXTI_IMR_MR23 */
  528. /**
  529. * @}
  530. */
  531. /* Exported functions --------------------------------------------------------*/
  532. /** @defgroup LPTIM_Exported_Functions LPTIM Exported Functions
  533. * @{
  534. */
  535. /** @addtogroup LPTIM_Exported_Functions_Group1
  536. * @brief Initialization and Configuration functions.
  537. * @{
  538. */
  539. /* Initialization/de-initialization functions ********************************/
  540. HAL_StatusTypeDef HAL_LPTIM_Init(LPTIM_HandleTypeDef *hlptim);
  541. HAL_StatusTypeDef HAL_LPTIM_DeInit(LPTIM_HandleTypeDef *hlptim);
  542. /* MSP functions *************************************************************/
  543. void HAL_LPTIM_MspInit(LPTIM_HandleTypeDef *hlptim);
  544. void HAL_LPTIM_MspDeInit(LPTIM_HandleTypeDef *hlptim);
  545. /**
  546. * @}
  547. */
  548. /** @addtogroup LPTIM_Exported_Functions_Group2
  549. * @brief Start-Stop operation functions.
  550. * @{
  551. */
  552. /* Start/Stop operation functions *********************************************/
  553. /* ################################# PWM Mode ################################*/
  554. /* Blocking mode: Polling */
  555. HAL_StatusTypeDef HAL_LPTIM_PWM_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
  556. HAL_StatusTypeDef HAL_LPTIM_PWM_Stop(LPTIM_HandleTypeDef *hlptim);
  557. /* Non-Blocking mode: Interrupt */
  558. HAL_StatusTypeDef HAL_LPTIM_PWM_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
  559. HAL_StatusTypeDef HAL_LPTIM_PWM_Stop_IT(LPTIM_HandleTypeDef *hlptim);
  560. /* ############################# One Pulse Mode ##############################*/
  561. /* Blocking mode: Polling */
  562. HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
  563. HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop(LPTIM_HandleTypeDef *hlptim);
  564. /* Non-Blocking mode: Interrupt */
  565. HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
  566. HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop_IT(LPTIM_HandleTypeDef *hlptim);
  567. /* ############################## Set once Mode ##############################*/
  568. /* Blocking mode: Polling */
  569. HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
  570. HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop(LPTIM_HandleTypeDef *hlptim);
  571. /* Non-Blocking mode: Interrupt */
  572. HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse);
  573. HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop_IT(LPTIM_HandleTypeDef *hlptim);
  574. /* ############################### Encoder Mode ##############################*/
  575. /* Blocking mode: Polling */
  576. HAL_StatusTypeDef HAL_LPTIM_Encoder_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
  577. HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop(LPTIM_HandleTypeDef *hlptim);
  578. /* Non-Blocking mode: Interrupt */
  579. HAL_StatusTypeDef HAL_LPTIM_Encoder_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
  580. HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop_IT(LPTIM_HandleTypeDef *hlptim);
  581. /* ############################# Time out Mode ##############################*/
  582. /* Blocking mode: Polling */
  583. HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout);
  584. HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop(LPTIM_HandleTypeDef *hlptim);
  585. /* Non-Blocking mode: Interrupt */
  586. HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout);
  587. HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop_IT(LPTIM_HandleTypeDef *hlptim);
  588. /* ############################## Counter Mode ###############################*/
  589. /* Blocking mode: Polling */
  590. HAL_StatusTypeDef HAL_LPTIM_Counter_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
  591. HAL_StatusTypeDef HAL_LPTIM_Counter_Stop(LPTIM_HandleTypeDef *hlptim);
  592. /* Non-Blocking mode: Interrupt */
  593. HAL_StatusTypeDef HAL_LPTIM_Counter_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period);
  594. HAL_StatusTypeDef HAL_LPTIM_Counter_Stop_IT(LPTIM_HandleTypeDef *hlptim);
  595. /**
  596. * @}
  597. */
  598. /** @addtogroup LPTIM_Exported_Functions_Group3
  599. * @brief Read operation functions.
  600. * @{
  601. */
  602. /* Reading operation functions ************************************************/
  603. uint32_t HAL_LPTIM_ReadCounter(LPTIM_HandleTypeDef *hlptim);
  604. uint32_t HAL_LPTIM_ReadAutoReload(LPTIM_HandleTypeDef *hlptim);
  605. uint32_t HAL_LPTIM_ReadCompare(LPTIM_HandleTypeDef *hlptim);
  606. /**
  607. * @}
  608. */
  609. /** @addtogroup LPTIM_Exported_Functions_Group4
  610. * @brief LPTIM IRQ handler and callback functions.
  611. * @{
  612. */
  613. /* LPTIM IRQ functions *******************************************************/
  614. void HAL_LPTIM_IRQHandler(LPTIM_HandleTypeDef *hlptim);
  615. /* CallBack functions ********************************************************/
  616. void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim);
  617. void HAL_LPTIM_AutoReloadMatchCallback(LPTIM_HandleTypeDef *hlptim);
  618. void HAL_LPTIM_TriggerCallback(LPTIM_HandleTypeDef *hlptim);
  619. void HAL_LPTIM_CompareWriteCallback(LPTIM_HandleTypeDef *hlptim);
  620. void HAL_LPTIM_AutoReloadWriteCallback(LPTIM_HandleTypeDef *hlptim);
  621. void HAL_LPTIM_DirectionUpCallback(LPTIM_HandleTypeDef *hlptim);
  622. void HAL_LPTIM_DirectionDownCallback(LPTIM_HandleTypeDef *hlptim);
  623. /* Callbacks Register/UnRegister functions ***********************************/
  624. #if (USE_HAL_LPTIM_REGISTER_CALLBACKS == 1)
  625. HAL_StatusTypeDef HAL_LPTIM_RegisterCallback(LPTIM_HandleTypeDef *lphtim, HAL_LPTIM_CallbackIDTypeDef CallbackID,
  626. pLPTIM_CallbackTypeDef pCallback);
  627. HAL_StatusTypeDef HAL_LPTIM_UnRegisterCallback(LPTIM_HandleTypeDef *lphtim, HAL_LPTIM_CallbackIDTypeDef CallbackID);
  628. #endif /* USE_HAL_LPTIM_REGISTER_CALLBACKS */
  629. /**
  630. * @}
  631. */
  632. /** @addtogroup LPTIM_Group5
  633. * @brief Peripheral State functions.
  634. * @{
  635. */
  636. /* Peripheral State functions ************************************************/
  637. HAL_LPTIM_StateTypeDef HAL_LPTIM_GetState(LPTIM_HandleTypeDef *hlptim);
  638. /**
  639. * @}
  640. */
  641. /**
  642. * @}
  643. */
  644. /* Private types -------------------------------------------------------------*/
  645. /** @defgroup LPTIM_Private_Types LPTIM Private Types
  646. * @{
  647. */
  648. /**
  649. * @}
  650. */
  651. /* Private variables ---------------------------------------------------------*/
  652. /** @defgroup LPTIM_Private_Variables LPTIM Private Variables
  653. * @{
  654. */
  655. /**
  656. * @}
  657. */
  658. /* Private constants ---------------------------------------------------------*/
  659. /** @defgroup LPTIM_Private_Constants LPTIM Private Constants
  660. * @{
  661. */
  662. /**
  663. * @}
  664. */
  665. /* Private macros ------------------------------------------------------------*/
  666. /** @defgroup LPTIM_Private_Macros LPTIM Private Macros
  667. * @{
  668. */
  669. #define IS_LPTIM_CLOCK_SOURCE(__SOURCE__) (((__SOURCE__) == LPTIM_CLOCKSOURCE_ULPTIM) || \
  670. ((__SOURCE__) == LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC))
  671. #define IS_LPTIM_CLOCK_PRESCALER(__PRESCALER__) (((__PRESCALER__) == LPTIM_PRESCALER_DIV1 ) || \
  672. ((__PRESCALER__) == LPTIM_PRESCALER_DIV2 ) || \
  673. ((__PRESCALER__) == LPTIM_PRESCALER_DIV4 ) || \
  674. ((__PRESCALER__) == LPTIM_PRESCALER_DIV8 ) || \
  675. ((__PRESCALER__) == LPTIM_PRESCALER_DIV16 ) || \
  676. ((__PRESCALER__) == LPTIM_PRESCALER_DIV32 ) || \
  677. ((__PRESCALER__) == LPTIM_PRESCALER_DIV64 ) || \
  678. ((__PRESCALER__) == LPTIM_PRESCALER_DIV128))
  679. #define IS_LPTIM_CLOCK_PRESCALERDIV1(__PRESCALER__) ((__PRESCALER__) == LPTIM_PRESCALER_DIV1)
  680. #define IS_LPTIM_OUTPUT_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_OUTPUTPOLARITY_LOW ) || \
  681. ((__POLARITY__) == LPTIM_OUTPUTPOLARITY_HIGH))
  682. #define IS_LPTIM_CLOCK_SAMPLE_TIME(__SAMPLETIME__) (((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION) || \
  683. ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_2TRANSITIONS) || \
  684. ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_4TRANSITIONS) || \
  685. ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_8TRANSITIONS))
  686. #define IS_LPTIM_CLOCK_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_CLOCKPOLARITY_RISING) || \
  687. ((__POLARITY__) == LPTIM_CLOCKPOLARITY_FALLING) || \
  688. ((__POLARITY__) == LPTIM_CLOCKPOLARITY_RISING_FALLING))
  689. #define IS_LPTIM_TRG_SOURCE(__TRIG__) (((__TRIG__) == LPTIM_TRIGSOURCE_SOFTWARE) || \
  690. ((__TRIG__) == LPTIM_TRIGSOURCE_0) || \
  691. ((__TRIG__) == LPTIM_TRIGSOURCE_1) || \
  692. ((__TRIG__) == LPTIM_TRIGSOURCE_2) || \
  693. ((__TRIG__) == LPTIM_TRIGSOURCE_3) || \
  694. ((__TRIG__) == LPTIM_TRIGSOURCE_4) || \
  695. ((__TRIG__) == LPTIM_TRIGSOURCE_5))
  696. #define IS_LPTIM_EXT_TRG_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_ACTIVEEDGE_RISING ) || \
  697. ((__POLARITY__) == LPTIM_ACTIVEEDGE_FALLING ) || \
  698. ((__POLARITY__) == LPTIM_ACTIVEEDGE_RISING_FALLING ))
  699. #define IS_LPTIM_TRIG_SAMPLE_TIME(__SAMPLETIME__) (((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION) || \
  700. ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_2TRANSITIONS ) || \
  701. ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_4TRANSITIONS ) || \
  702. ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_8TRANSITIONS ))
  703. #define IS_LPTIM_UPDATE_MODE(__MODE__) (((__MODE__) == LPTIM_UPDATE_IMMEDIATE) || \
  704. ((__MODE__) == LPTIM_UPDATE_ENDOFPERIOD))
  705. #define IS_LPTIM_COUNTER_SOURCE(__SOURCE__) (((__SOURCE__) == LPTIM_COUNTERSOURCE_INTERNAL) || \
  706. ((__SOURCE__) == LPTIM_COUNTERSOURCE_EXTERNAL))
  707. #define IS_LPTIM_AUTORELOAD(__AUTORELOAD__) ((__AUTORELOAD__) <= 0x0000FFFFUL)
  708. #define IS_LPTIM_COMPARE(__COMPARE__) ((__COMPARE__) <= 0x0000FFFFUL)
  709. #define IS_LPTIM_PERIOD(__PERIOD__) ((__PERIOD__) <= 0x0000FFFFUL)
  710. #define IS_LPTIM_PULSE(__PULSE__) ((__PULSE__) <= 0x0000FFFFUL)
  711. /**
  712. * @}
  713. */
  714. /* Private functions ---------------------------------------------------------*/
  715. /** @defgroup LPTIM_Private_Functions LPTIM Private Functions
  716. * @{
  717. */
  718. void LPTIM_Disable(LPTIM_HandleTypeDef *hlptim);
  719. /**
  720. * @}
  721. */
  722. /**
  723. * @}
  724. */
  725. #endif /* LPTIM1 */
  726. /**
  727. * @}
  728. */
  729. #ifdef __cplusplus
  730. }
  731. #endif
  732. #endif /* STM32F4xx_HAL_LPTIM_H */
  733. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/