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

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
<>
Date:
Mon Jan 16 12:05:23 2017 +0000
Revision:
134:ad3be0349dc5
Parent:
128:9bcdf88f62b0
Child:
145:64910690c574
Release 134 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3488: Dev stm i2c v2 unitary functions https://github.com/ARMmbed/mbed-os/pull/3488
3492: Fix #3463 CAN read() return value https://github.com/ARMmbed/mbed-os/pull/3492
3503: [LPC15xx] Ensure that PWM=1 is resolved correctly https://github.com/ARMmbed/mbed-os/pull/3503
3504: [LPC15xx] CAN implementation improvements https://github.com/ARMmbed/mbed-os/pull/3504
3539: NUCLEO_F412ZG - Add support of TRNG peripheral https://github.com/ARMmbed/mbed-os/pull/3539
3540: STM: SPI: Initialize Rx in spi_master_write https://github.com/ARMmbed/mbed-os/pull/3540
3438: K64F: Add support for SERIAL ASYNCH API https://github.com/ARMmbed/mbed-os/pull/3438
3519: MCUXpresso: Fix ENET driver to enable interrupts after interrupt handler is set https://github.com/ARMmbed/mbed-os/pull/3519
3544: STM32L4 deepsleep improvement https://github.com/ARMmbed/mbed-os/pull/3544
3546: NUCLEO-F412ZG - Add CAN peripheral https://github.com/ARMmbed/mbed-os/pull/3546
3551: Fix I2C driver for RZ/A1H https://github.com/ARMmbed/mbed-os/pull/3551
3558: K64F UART Asynch API: Fix synchronization issue https://github.com/ARMmbed/mbed-os/pull/3558
3563: LPC4088 - Fix vector checksum https://github.com/ARMmbed/mbed-os/pull/3563
3567: Dev stm32 F0 v1.7.0 https://github.com/ARMmbed/mbed-os/pull/3567
3577: Fixes linking errors when building with debug profile https://github.com/ARMmbed/mbed-os/pull/3577

Who changed what in which revision?

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