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