Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
110:165afa46840b
.

Who changed what in which revision?

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