mbed library sources

Dependents:   Marvino mbot

Fork of mbed-src by mbed official

Committer:
jaerts
Date:
Tue Dec 22 13:22:16 2015 +0000
Revision:
637:ed69428d4850
Parent:
610:813dcc80987e
Add very shady LPC1768 CAN Filter implementation

Who changed what in which revision?

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