inport from local

Dependents:   Hobbyking_Cheetah_0511

Committer:
NYX
Date:
Mon Mar 16 06:35:48 2020 +0000
Revision:
0:85b3fd62ea1a
reinport to mbed;

Who changed what in which revision?

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