Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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