mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Wed Jan 13 09:48:29 2016 +0000
Revision:
112:6f327212ef96
Child:
122:f9eeca106725
Release 112 of the mbed library

Changes:
- new platforms - STM32 B96B F446, MOTE_L152RC
- nrf51 - fix serial init bug (character sent)
- stm all devices - fix RTC clocking in the init
- stm f0 - SystemInit clock fix, for SetVector()
- RawSerial - fix for microlib (vsnprintf with size 0)

Who changed what in which revision?

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