mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Wed Jul 01 09:45:11 2015 +0100
Revision:
579:53297373a894
Parent:
489:119543c9f674
Synchronized with git revision d5b4d2ab9c47edb4dc5776e7177b0c2263459081

Full URL: https://github.com/mbedmicro/mbed/commit/d5b4d2ab9c47edb4dc5776e7177b0c2263459081/

Initial version of drivers for SAMR21

Who changed what in which revision?

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