fix LPC812 PWM

Dependents:   IR_LED_Send

Fork of mbed-dev by mbed official

Committer:
nameless129
Date:
Mon May 16 16:50:30 2016 +0000
Revision:
129:2e517c56bcfb
Parent:
19:112740acecfa
PWM Fix:Duty 0%??H???????????????

Who changed what in which revision?

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