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:
99:dbbf35b96557
.

Who changed what in which revision?

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