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

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
107:4f6c30876dfa
.

Who changed what in which revision?

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