mbed library sources
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F334R8/stm32f3xx_hal_hrtim.c@237:f3da66175598, 2014-06-24 (annotated)
- Committer:
- mbed_official
- Date:
- Tue Jun 24 14:45:08 2014 +0100
- Revision:
- 237:f3da66175598
- Child:
- 375:3d36234a1087
Synchronized with git revision 8ef659bca81f12dfc896b5a7af7c2abbd1a1b8b7
Full URL: https://github.com/mbedmicro/mbed/commit/8ef659bca81f12dfc896b5a7af7c2abbd1a1b8b7/
[NUCLEO_F334R8] Add platform files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 237:f3da66175598 | 1 | /** |
mbed_official | 237:f3da66175598 | 2 | ****************************************************************************** |
mbed_official | 237:f3da66175598 | 3 | * @file stm32f3xx_hal_hrtim.c |
mbed_official | 237:f3da66175598 | 4 | * @author MCD Application Team |
mbed_official | 237:f3da66175598 | 5 | * @version V1.0.1 |
mbed_official | 237:f3da66175598 | 6 | * @date 18-June-2014 |
mbed_official | 237:f3da66175598 | 7 | * @brief TIM HAL module driver. |
mbed_official | 237:f3da66175598 | 8 | * This file provides firmware functions to manage the following |
mbed_official | 237:f3da66175598 | 9 | * functionalities of the High Resolution Timer (HRTIM) peripheral: |
mbed_official | 237:f3da66175598 | 10 | * + HRTIM Initialization |
mbed_official | 237:f3da66175598 | 11 | * + DLL Calibration Start |
mbed_official | 237:f3da66175598 | 12 | * + Timer Time Base Unit Configuration |
mbed_official | 237:f3da66175598 | 13 | * + Simple Time Base Start/Stop |
mbed_official | 237:f3da66175598 | 14 | * + Simple Time Base Start/Stop Interrupt |
mbed_official | 237:f3da66175598 | 15 | * + Simple Time Base Start/Stop DMA Request |
mbed_official | 237:f3da66175598 | 16 | * + Simple Output Compare/PWM Channel Configuration |
mbed_official | 237:f3da66175598 | 17 | * + Simple Output Compare/PWM Channel Start/Stop Interrupt |
mbed_official | 237:f3da66175598 | 18 | * + Simple Output Compare/PWM Channel Start/Stop DMA Request |
mbed_official | 237:f3da66175598 | 19 | * + Simple Input Capture Channel Configuration |
mbed_official | 237:f3da66175598 | 20 | * + Simple Input Capture Channel Start/Stop Interrupt |
mbed_official | 237:f3da66175598 | 21 | * + Simple Input Capture Channel Start/Stop DMA Request |
mbed_official | 237:f3da66175598 | 22 | * + Simple One Pulse Channel Configuration |
mbed_official | 237:f3da66175598 | 23 | * + Simple One Pulse Channel Start/Stop Interrupt |
mbed_official | 237:f3da66175598 | 24 | * + HRTIM External Synchronization Configuration |
mbed_official | 237:f3da66175598 | 25 | * + HRTIM Burst Mode Controller Configuration |
mbed_official | 237:f3da66175598 | 26 | * + HRTIM Burst Mode Controller Enabling |
mbed_official | 237:f3da66175598 | 27 | * + HRTIM External Events Conditioning Configuration |
mbed_official | 237:f3da66175598 | 28 | * + HRTIM Faults Conditioning Configuration |
mbed_official | 237:f3da66175598 | 29 | * + HRTIM Faults Enabling |
mbed_official | 237:f3da66175598 | 30 | * + HRTIM ADC trigger Configuration |
mbed_official | 237:f3da66175598 | 31 | * + Waveform Timer Configuration |
mbed_official | 237:f3da66175598 | 32 | * + Waveform Event Filtering Configuration |
mbed_official | 237:f3da66175598 | 33 | * + Waveform Dead Time Insertion Configuration |
mbed_official | 237:f3da66175598 | 34 | * + Waveform Chopper Mode Configuration |
mbed_official | 237:f3da66175598 | 35 | * + Waveform Compare Unit Configuration |
mbed_official | 237:f3da66175598 | 36 | * + Waveform Capture Unit Configuration |
mbed_official | 237:f3da66175598 | 37 | * + Waveform Output Configuration |
mbed_official | 237:f3da66175598 | 38 | * + Waveform Counter Start/Stop |
mbed_official | 237:f3da66175598 | 39 | * + Waveform Counter Start/Stop Interrupt |
mbed_official | 237:f3da66175598 | 40 | * + Waveform Counter Start/Stop DMA Request |
mbed_official | 237:f3da66175598 | 41 | * + Waveform Output Enabling |
mbed_official | 237:f3da66175598 | 42 | * + Waveform Output Level Set/Get |
mbed_official | 237:f3da66175598 | 43 | * + Waveform Output State Get |
mbed_official | 237:f3da66175598 | 44 | * + Waveform Burst DMA Operation Configuration |
mbed_official | 237:f3da66175598 | 45 | * + Waveform Burst DMA Operation Start |
mbed_official | 237:f3da66175598 | 46 | * + Waveform Timer Counter Software Reset |
mbed_official | 237:f3da66175598 | 47 | * + Waveform Capture Software Trigger |
mbed_official | 237:f3da66175598 | 48 | * + Waveform Burst Mode Controller Software Trigger |
mbed_official | 237:f3da66175598 | 49 | * + Waveform Timer Pre-loadable Registers Update Enabling |
mbed_official | 237:f3da66175598 | 50 | * + Waveform Timer Pre-loadable Registers Software Update |
mbed_official | 237:f3da66175598 | 51 | * + Waveform Timer Delayed Protection Status Get |
mbed_official | 237:f3da66175598 | 52 | * + Waveform Timer Burst Status Get |
mbed_official | 237:f3da66175598 | 53 | * + Waveform Timer Push-Pull Status Get |
mbed_official | 237:f3da66175598 | 54 | * + Peripheral State Get |
mbed_official | 237:f3da66175598 | 55 | @verbatim |
mbed_official | 237:f3da66175598 | 56 | ============================================================================== |
mbed_official | 237:f3da66175598 | 57 | ##### Simple mode v.s. waveform mode ##### |
mbed_official | 237:f3da66175598 | 58 | ============================================================================== |
mbed_official | 237:f3da66175598 | 59 | [..] The HRTIM HAL API is split into 2 categories: |
mbed_official | 237:f3da66175598 | 60 | (#)Simple functions: these functions allow for using a HRTIM timer as a |
mbed_official | 237:f3da66175598 | 61 | general purpose timer with high resolution capabilities. |
mbed_official | 237:f3da66175598 | 62 | Following simple modes are proposed: |
mbed_official | 237:f3da66175598 | 63 | (+)Output compare mode |
mbed_official | 237:f3da66175598 | 64 | (+)PWM output mode |
mbed_official | 237:f3da66175598 | 65 | (+)Input capture mode |
mbed_official | 237:f3da66175598 | 66 | (+)One pulse mode |
mbed_official | 237:f3da66175598 | 67 | HRTIM simple modes are managed through the set of functions named |
mbed_official | 237:f3da66175598 | 68 | HAL_HRTIM_Simple<Function>. These functions are similar in name and usage |
mbed_official | 237:f3da66175598 | 69 | to the one defined for the TIM peripheral. When a HRTIM timer operates in |
mbed_official | 237:f3da66175598 | 70 | simple mode, only a very limited set of HRTIM features are used. |
mbed_official | 237:f3da66175598 | 71 | (#)Waveform functions: These functions allow taking advantage of the HRTIM |
mbed_official | 237:f3da66175598 | 72 | flexibility to produce numerous types of control signal. When a HRTIM timer |
mbed_official | 237:f3da66175598 | 73 | operates in waveform mode, all the HRTIM features are accessible without |
mbed_official | 237:f3da66175598 | 74 | any restriction. HRTIM waveform modes are managed through the set of |
mbed_official | 237:f3da66175598 | 75 | functions named HAL_HRTIM_Waveform<Function> |
mbed_official | 237:f3da66175598 | 76 | |
mbed_official | 237:f3da66175598 | 77 | ============================================================================== |
mbed_official | 237:f3da66175598 | 78 | ##### How to use this driver ##### |
mbed_official | 237:f3da66175598 | 79 | ============================================================================== |
mbed_official | 237:f3da66175598 | 80 | [..] |
mbed_official | 237:f3da66175598 | 81 | (#)Initialize the HRTIM low level resources by implementing the |
mbed_official | 237:f3da66175598 | 82 | HAL_HRTIM_MspInit() function: |
mbed_official | 237:f3da66175598 | 83 | (##)Enable the HRTIM clock source using __HRTIMx_CLK_ENABLE() |
mbed_official | 237:f3da66175598 | 84 | (##)Connect HRTIM pins to MCU I/Os |
mbed_official | 237:f3da66175598 | 85 | (+++) Enable the clock for the HRTIM GPIOs using the following |
mbed_official | 237:f3da66175598 | 86 | function: __GPIOx_CLK_ENABLE() |
mbed_official | 237:f3da66175598 | 87 | (+++) Configure these GPIO pins in Alternate Function mode using |
mbed_official | 237:f3da66175598 | 88 | HAL_GPIO_Init() |
mbed_official | 237:f3da66175598 | 89 | (##)When using DMA to control data transfer (e.g HAL_HRTIM_SimpleBaseStart_DMA()) |
mbed_official | 237:f3da66175598 | 90 | (+++)Enable the DMAx interface clock using __DMAx_CLK_ENABLE() |
mbed_official | 237:f3da66175598 | 91 | (+++)Initialize the DMA handle |
mbed_official | 237:f3da66175598 | 92 | (+++)Associate the initialized DMA handle to the appropriate DMA |
mbed_official | 237:f3da66175598 | 93 | handle of the HRTIM handle using __HAL_LINKDMA() |
mbed_official | 237:f3da66175598 | 94 | (+++)Initialize the DMA channel using HAL_DMA_Init() |
mbed_official | 237:f3da66175598 | 95 | (+++)Configure the priority and enable the NVIC for the transfer |
mbed_official | 237:f3da66175598 | 96 | complete interrupt on the DMA channel using HAL_NVIC_SetPriority() |
mbed_official | 237:f3da66175598 | 97 | and HAL_NVIC_EnableIRQ() |
mbed_official | 237:f3da66175598 | 98 | (##)In case of using interrupt mode (e.g HAL_HRTIM_SimpleBaseStart_IT()) |
mbed_official | 237:f3da66175598 | 99 | (+++)Configure the priority and enable the NVIC for the concerned |
mbed_official | 237:f3da66175598 | 100 | HRTIM interrupt using HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ() |
mbed_official | 237:f3da66175598 | 101 | |
mbed_official | 237:f3da66175598 | 102 | (#)Initialize the HRTIM HAL using HAL_HRTIM_Init(). The HRTIM configuration |
mbed_official | 237:f3da66175598 | 103 | structure (field of the HRTIM handle) specifies which global interrupt of |
mbed_official | 237:f3da66175598 | 104 | whole HRTIM must be enabled (Burst mode period, System fault, Faults). |
mbed_official | 237:f3da66175598 | 105 | It also contains the HRTIM external synchronization configuration. HRTIM |
mbed_official | 237:f3da66175598 | 106 | can act as a master (generating a synchronization signal) or as a slave |
mbed_official | 237:f3da66175598 | 107 | (waiting for a trigger to be synchronized). |
mbed_official | 237:f3da66175598 | 108 | |
mbed_official | 237:f3da66175598 | 109 | (#)Start the high resolution unit using HAL_HRTIM_DLLCalibrationStart(). DLL |
mbed_official | 237:f3da66175598 | 110 | calibration is executed periodically and compensate for potential voltage |
mbed_official | 237:f3da66175598 | 111 | and temperature drifts. DLL calibration period is specified by the |
mbed_official | 237:f3da66175598 | 112 | CalibrationRate argument. |
mbed_official | 237:f3da66175598 | 113 | |
mbed_official | 237:f3da66175598 | 114 | (#)HRTIM timers cannot be used until the high resolution unit is ready. This |
mbed_official | 237:f3da66175598 | 115 | can be checked using HAL_HRTIM_PollForDLLCalibration(): this function returns |
mbed_official | 237:f3da66175598 | 116 | HAL_OK if DLL calibration is completed or HAL_TIMEOUT if the DLL calibration |
mbed_official | 237:f3da66175598 | 117 | is still going on when timeout given is argument expires. DLL calibration |
mbed_official | 237:f3da66175598 | 118 | can also be started in interrupt mode using HAL_HRTIM_DLLCalibrationStart_IT(). |
mbed_official | 237:f3da66175598 | 119 | In that case an interrupt is generated when the DLL calibration is completed. |
mbed_official | 237:f3da66175598 | 120 | Note that as DLL calibration is executed on a periodic basis an interrupt |
mbed_official | 237:f3da66175598 | 121 | will be generated at the end of every DLL calibration operation |
mbed_official | 237:f3da66175598 | 122 | (worst case: one interrupt every 14 micro seconds !). |
mbed_official | 237:f3da66175598 | 123 | |
mbed_official | 237:f3da66175598 | 124 | (#) Configure HRTIM resources shared by all HRTIM timers |
mbed_official | 237:f3da66175598 | 125 | (##)Burst Mode Controller: |
mbed_official | 237:f3da66175598 | 126 | (+++)HAL_HRTIM_BurstModeConfig(): configures the HRTIM burst mode |
mbed_official | 237:f3da66175598 | 127 | controller: operating mode (continuous or -shot mode), clock |
mbed_official | 237:f3da66175598 | 128 | (source, prescaler) , trigger(s), period, idle duration. |
mbed_official | 237:f3da66175598 | 129 | (##)External Events Conditionning: |
mbed_official | 237:f3da66175598 | 130 | (+++)HAL_HRTIM_EventConfig(): configures the conditioning of an |
mbed_official | 237:f3da66175598 | 131 | external event channel: source, polarity, edge-sensitivity. |
mbed_official | 237:f3da66175598 | 132 | External event can be used as triggers (timer reset, input |
mbed_official | 237:f3da66175598 | 133 | capture, burst mode, ADC triggers, delayed protection, ) |
mbed_official | 237:f3da66175598 | 134 | They can also be used to set or reset timer outputs. Up to |
mbed_official | 237:f3da66175598 | 135 | 10 event channels are available. |
mbed_official | 237:f3da66175598 | 136 | (+++)HAL_HRTIM_EventPrescalerConfig(): configures the external |
mbed_official | 237:f3da66175598 | 137 | event sampling clock (used for digital filtering). |
mbed_official | 237:f3da66175598 | 138 | (##)Fault Conditionning: |
mbed_official | 237:f3da66175598 | 139 | (+++)HAL_HRTIM_FaultConfig(): configures the conditioning of a |
mbed_official | 237:f3da66175598 | 140 | fault channel: source, polarity, edge-sensitivity. Fault |
mbed_official | 237:f3da66175598 | 141 | channels are used to disable the outputs in case of an |
mbed_official | 237:f3da66175598 | 142 | abnormal operation. Up to 5 fault channels are available. |
mbed_official | 237:f3da66175598 | 143 | (+++)HAL_HRTIM_FaultPrescalerConfig(): configures the fault |
mbed_official | 237:f3da66175598 | 144 | sampling clock (used for digital filtering). |
mbed_official | 237:f3da66175598 | 145 | (+++)HAL_HRTIM_FaultModeCtl(): Enables or disables fault input(s) |
mbed_official | 237:f3da66175598 | 146 | circuitry. By default all fault inputs are disabled. |
mbed_official | 237:f3da66175598 | 147 | (##)ADC trigger: |
mbed_official | 237:f3da66175598 | 148 | (+++)HAL_HRTIM_ADCTriggerConfig(): configures the source triggering |
mbed_official | 237:f3da66175598 | 149 | the update of the ADC trigger register and the ADC trigger. |
mbed_official | 237:f3da66175598 | 150 | 4 independent triggers are available to start both the regular |
mbed_official | 237:f3da66175598 | 151 | and the injected sequencers of the 2 ADCs |
mbed_official | 237:f3da66175598 | 152 | |
mbed_official | 237:f3da66175598 | 153 | (#) Configure HRTIM timer time base using HAL_HRTIM_TimeBaseConfig(). This |
mbed_official | 237:f3da66175598 | 154 | function must be called whatever the HRTIM timer operating mode is |
mbed_official | 237:f3da66175598 | 155 | (simple v.s. waveform). It configures mainly: |
mbed_official | 237:f3da66175598 | 156 | (##)The HRTIM timer counter operating mode (continuous, one shot) |
mbed_official | 237:f3da66175598 | 157 | (##)The HRTIM timer clock prescaler |
mbed_official | 237:f3da66175598 | 158 | (##)The HRTIM timer period |
mbed_official | 237:f3da66175598 | 159 | (##)The HRTIM timer repetition counter |
mbed_official | 237:f3da66175598 | 160 | |
mbed_official | 237:f3da66175598 | 161 | (#) If the HRTIM timer operates in simple mode: |
mbed_official | 237:f3da66175598 | 162 | (##)Simple time base: HAL_HRTIM_SimpleBaseStart(),HAL_HRTIM_SimpleBaseStop(), |
mbed_official | 237:f3da66175598 | 163 | HAL_HRTIM_SimpleBaseStart_IT(),HAL_HRTIM_SimpleBaseStop_IT(), |
mbed_official | 237:f3da66175598 | 164 | HAL_HRTIM_SimpleBaseStart_DMA(),HAL_HRTIM_SimpleBaseStop_DMA(). |
mbed_official | 237:f3da66175598 | 165 | (##)Simple output compare: HAL_HRTIM_SimpleOCChannelConfig(), |
mbed_official | 237:f3da66175598 | 166 | HAL_HRTIM_SimpleOCStart(),HAL_HRTIM_SimpleOCStop(), |
mbed_official | 237:f3da66175598 | 167 | HAL_HRTIM_SimpleOCStart_IT(),HAL_HRTIM_SimpleOCStop_IT(), |
mbed_official | 237:f3da66175598 | 168 | HAL_HRTIM_SimpleOCStart_DMA(),HAL_HRTIM_SimpleOCStop_DMA(), |
mbed_official | 237:f3da66175598 | 169 | (##)Simple PWM output: HAL_HRTIM_SimplePWMChannelConfig(), |
mbed_official | 237:f3da66175598 | 170 | HAL_HRTIM_SimplePWMStart(),HAL_HRTIM_SimplePWMStop(), |
mbed_official | 237:f3da66175598 | 171 | HAL_HRTIM_SimplePWMStart_IT(),HAL_HRTIM_SimplePWMStop_IT(), |
mbed_official | 237:f3da66175598 | 172 | HAL_HRTIM_SimplePWMStart_DMA(),HAL_HRTIM_SimplePWMStop_DMA(), |
mbed_official | 237:f3da66175598 | 173 | (##)Simple input capture: HAL_HRTIM_SimpleCaptureChannelConfig(), |
mbed_official | 237:f3da66175598 | 174 | HAL_HRTIM_SimpleCaptureStart(),HAL_HRTIM_SimpleCaptureStop(), |
mbed_official | 237:f3da66175598 | 175 | HAL_HRTIM_SimpleCaptureStart_IT(),HAL_HRTIM_SimpleCaptureStop_IT(), |
mbed_official | 237:f3da66175598 | 176 | HAL_HRTIM_SimpleCaptureStart_DMA(),HAL_HRTIM_SimpleCaptureStop_DMA(). |
mbed_official | 237:f3da66175598 | 177 | (##)Simple one pulse: HAL_HRTIM_SimpleOnePulseChannelConfig(), |
mbed_official | 237:f3da66175598 | 178 | HAL_HRTIM_SimpleOnePulseStart(),HAL_HRTIM_SimpleOnePulseStop(), |
mbed_official | 237:f3da66175598 | 179 | HAL_HRTIM_SimpleOnePulseStart_IT(),HAL_HRTIM_SimpleOnePulseStop_It(). |
mbed_official | 237:f3da66175598 | 180 | |
mbed_official | 237:f3da66175598 | 181 | (#) If the HRTIM timer operates in waveform mode: |
mbed_official | 237:f3da66175598 | 182 | (##)Completes waveform timer configuration |
mbed_official | 237:f3da66175598 | 183 | (+++)HAL_HRTIM_WaveformTimerConfig(): configuration of a HRTIM |
mbed_official | 237:f3da66175598 | 184 | timer operating in wave form mode mainly consists in: |
mbed_official | 237:f3da66175598 | 185 | - Enabling the HRTIM timer interrupts and DMA requests, |
mbed_official | 237:f3da66175598 | 186 | - Enabling the half mode for the HRTIM timer, |
mbed_official | 237:f3da66175598 | 187 | - Defining how the HRTIM timer reacts to external |
mbed_official | 237:f3da66175598 | 188 | synchronization input, |
mbed_official | 237:f3da66175598 | 189 | - Enabling the push-pull mode for the HRTIM timer, |
mbed_official | 237:f3da66175598 | 190 | - Enabling the fault channels for the HRTIM timer, |
mbed_official | 237:f3da66175598 | 191 | - Enabling the deadtime insertion for the HRTIM timer, |
mbed_official | 237:f3da66175598 | 192 | - Setting the delayed protection mode for the HRTIM timer |
mbed_official | 237:f3da66175598 | 193 | (source and outputs on which the delayed protection are applied), |
mbed_official | 237:f3da66175598 | 194 | - Specifying the HRTIM timer update and reset triggers, |
mbed_official | 237:f3da66175598 | 195 | - Specifying the HRTIM timer registers update policy (preload enabling, ). |
mbed_official | 237:f3da66175598 | 196 | (+++)HAL_HRTIM_TimerEventFilteringConfig(): configures external |
mbed_official | 237:f3da66175598 | 197 | event blanking and windowingcircuitry of a HRTIM timer: |
mbed_official | 237:f3da66175598 | 198 | - Blanking: to mask external events during a defined |
mbed_official | 237:f3da66175598 | 199 | time period |
mbed_official | 237:f3da66175598 | 200 | - Windowing: to enable external events only during |
mbed_official | 237:f3da66175598 | 201 | a defined time period |
mbed_official | 237:f3da66175598 | 202 | (+++)HAL_HRTIM_DeadTimeConfig(): configures the deadtime insertion |
mbed_official | 237:f3da66175598 | 203 | unit for a HRTIM timer. Allows to generate a couple of |
mbed_official | 237:f3da66175598 | 204 | complementary signals from a single reference waveform, |
mbed_official | 237:f3da66175598 | 205 | with programmable delays between active state. |
mbed_official | 237:f3da66175598 | 206 | (+++)HAL_HRTIM_ChopperModeConfig(): configures the parameters of |
mbed_official | 237:f3da66175598 | 207 | the high-frequency carrier signal added on top of the timing |
mbed_official | 237:f3da66175598 | 208 | unit output. Chopper mode can be enabled or disabled for each |
mbed_official | 237:f3da66175598 | 209 | timer output separately (see HAL_HRTIM_WaveformOutputConfig()). |
mbed_official | 237:f3da66175598 | 210 | (+++)HAL_HRTIM_BurstDMAConfig(): configures the burst DMA burst |
mbed_official | 237:f3da66175598 | 211 | controller. Allows having multiple HRTIM registers updated |
mbed_official | 237:f3da66175598 | 212 | with a single DMA request. The burst DMA operation is started |
mbed_official | 237:f3da66175598 | 213 | by calling HAL_HRTIM_BurstDMATransfer(). |
mbed_official | 237:f3da66175598 | 214 | (+++)HAL_HRTIM_WaveformCompareConfig():configures the compare unit |
mbed_official | 237:f3da66175598 | 215 | of a HRTIM timer. This operation consists in setting the |
mbed_official | 237:f3da66175598 | 216 | compare value and possibly specifying the auto delayed mode |
mbed_official | 237:f3da66175598 | 217 | for compare units 2 and 4 (allows to have compare events |
mbed_official | 237:f3da66175598 | 218 | generated relatively to capture events). Note that when auto |
mbed_official | 237:f3da66175598 | 219 | delayed mode is needed, the capture unit associated to the |
mbed_official | 237:f3da66175598 | 220 | compare unit must be configured separately. |
mbed_official | 237:f3da66175598 | 221 | (+++)HAL_HRTIM_WaveformCaptureConfig(): configures the capture unit |
mbed_official | 237:f3da66175598 | 222 | of a HRTIM timer. This operation consists in specifying the |
mbed_official | 237:f3da66175598 | 223 | source(s) triggering the capture (timer register update event, |
mbed_official | 237:f3da66175598 | 224 | external event, timer output set/reset event, other HRTIM |
mbed_official | 237:f3da66175598 | 225 | timer related events). |
mbed_official | 237:f3da66175598 | 226 | (+++)HAL_HRTIM_WaveformOutputConfig(): configuration HRTIM timer |
mbed_official | 237:f3da66175598 | 227 | output manly consists in: |
mbed_official | 237:f3da66175598 | 228 | - Setting the output polarity (active high or active low), |
mbed_official | 237:f3da66175598 | 229 | - Defining the set/reset crossbar for the output, |
mbed_official | 237:f3da66175598 | 230 | - Specifying the fault level (active or inactive) in IDLE |
mbed_official | 237:f3da66175598 | 231 | and FAULT states., |
mbed_official | 237:f3da66175598 | 232 | (##)Set waveform timer output(s) level |
mbed_official | 237:f3da66175598 | 233 | (+++)HAL_HRTIM_WaveformSetOutputLevel(): forces the output to its |
mbed_official | 237:f3da66175598 | 234 | active or inactive level. For example, when deadtime insertion |
mbed_official | 237:f3da66175598 | 235 | is enabled it is necessary to force the output level by software |
mbed_official | 237:f3da66175598 | 236 | to have the outputs in a complementary state as soon as the RUN mode is entered. |
mbed_official | 237:f3da66175598 | 237 | (##)Enable/Disable waveform timer output(s) |
mbed_official | 237:f3da66175598 | 238 | (+++)HAL_HRTIM_WaveformOutputStart(),HAL_HRTIM_WaveformOutputStop(). |
mbed_official | 237:f3da66175598 | 239 | (##)Start/Stop waveform HRTIM timer(s). |
mbed_official | 237:f3da66175598 | 240 | (+++)HAL_HRTIM_WaveformCounterStart(),HAL_HRTIM_WaveformCounterStop(), |
mbed_official | 237:f3da66175598 | 241 | (+++)HAL_HRTIM_WaveformCounterStart_IT(),HAL_HRTIM_WaveformCounterStop_IT(), |
mbed_official | 237:f3da66175598 | 242 | (+++)HAL_HRTIM_WaveformCounterStart()_DMA,HAL_HRTIM_WaveformCounterStop_DMA(), |
mbed_official | 237:f3da66175598 | 243 | |
mbed_official | 237:f3da66175598 | 244 | (##)Burst mode controller enabling: |
mbed_official | 237:f3da66175598 | 245 | (+++)HAL_HRTIM_BurstModeCtl(): activates or de-activates the |
mbed_official | 237:f3da66175598 | 246 | burst mode controller. |
mbed_official | 237:f3da66175598 | 247 | |
mbed_official | 237:f3da66175598 | 248 | (##)Some HRTIM operations can be triggered by software: |
mbed_official | 237:f3da66175598 | 249 | (+++)HAL_HRTIM_BurstModeSoftwareTrigger(): calling this function |
mbed_official | 237:f3da66175598 | 250 | trigs the burst operation. |
mbed_official | 237:f3da66175598 | 251 | (+++)HAL_HRTIM_SoftwareCapture(): calling this function trigs the |
mbed_official | 237:f3da66175598 | 252 | capture of the HRTIM timer counter. |
mbed_official | 237:f3da66175598 | 253 | (+++)HAL_HRTIM_SoftwareUpdate(): calling this function trigs the |
mbed_official | 237:f3da66175598 | 254 | update of the pre-loadable registers of the HRTIM timer () |
mbed_official | 237:f3da66175598 | 255 | (+++)HAL_HRTIM_SoftwareReset():calling this function resets the |
mbed_official | 237:f3da66175598 | 256 | HRTIM timer counter. |
mbed_official | 237:f3da66175598 | 257 | |
mbed_official | 237:f3da66175598 | 258 | (##)Some functions can be used anytime to retrieve HRTIM timer related |
mbed_official | 237:f3da66175598 | 259 | information |
mbed_official | 237:f3da66175598 | 260 | (+++)HAL_HRTIM_GetCapturedValue(): returns actual value of the |
mbed_official | 237:f3da66175598 | 261 | capture register of the designated capture unit. |
mbed_official | 237:f3da66175598 | 262 | (+++)HAL_HRTIM_WaveformGetOutputLevel(): returns actual level |
mbed_official | 237:f3da66175598 | 263 | (ACTIVE/INACTIVE) of the designated timer output. |
mbed_official | 237:f3da66175598 | 264 | (+++)HAL_HRTIM_WaveformGetOutputState():returns actual state |
mbed_official | 237:f3da66175598 | 265 | (IDLE/RUN/FAULT) of the designated timer output. |
mbed_official | 237:f3da66175598 | 266 | (+++)HAL_HRTIM_GetDelayedProtectionStatus():returns actual level |
mbed_official | 237:f3da66175598 | 267 | (ACTIVE/INACTIVE) of the designated output when the delayed |
mbed_official | 237:f3da66175598 | 268 | protection was triggered. |
mbed_official | 237:f3da66175598 | 269 | (+++)HAL_HRTIM_GetBurstStatus(): returns the actual status |
mbed_official | 237:f3da66175598 | 270 | (ACTIVE/INACTIVE) of the burst mode controller. |
mbed_official | 237:f3da66175598 | 271 | (+++)HAL_HRTIM_GetCurrentPushPullStatus(): when the push-pull mode |
mbed_official | 237:f3da66175598 | 272 | is enabled for the HRTIM timer (see HAL_HRTIM_WaveformTimerConfig()), |
mbed_official | 237:f3da66175598 | 273 | the push-pull indicates on which output the signal is currently |
mbed_official | 237:f3da66175598 | 274 | active (e.g signal applied on output 1 and output 2 forced |
mbed_official | 237:f3da66175598 | 275 | inactive or vice versa). |
mbed_official | 237:f3da66175598 | 276 | (+++)HAL_HRTIM_GetIdlePushPullStatus(): when the push-pull mode |
mbed_official | 237:f3da66175598 | 277 | is enabled for the HRTIM timer (see HAL_HRTIM_WaveformTimerConfig()), |
mbed_official | 237:f3da66175598 | 278 | the idle push-pull status indicates during which period the |
mbed_official | 237:f3da66175598 | 279 | delayed protection request occurred (e.g. protection occurred |
mbed_official | 237:f3da66175598 | 280 | when the output 1 was active and output 2 forced inactive or |
mbed_official | 237:f3da66175598 | 281 | vice versa). |
mbed_official | 237:f3da66175598 | 282 | |
mbed_official | 237:f3da66175598 | 283 | (##)Some functions can be used anytime to retrieve actual HRTIM status |
mbed_official | 237:f3da66175598 | 284 | (+++)HAL_HRTIM_GetState(): returns actual HRTIM instance HAL state. |
mbed_official | 237:f3da66175598 | 285 | |
mbed_official | 237:f3da66175598 | 286 | @endverbatim |
mbed_official | 237:f3da66175598 | 287 | |
mbed_official | 237:f3da66175598 | 288 | ****************************************************************************** |
mbed_official | 237:f3da66175598 | 289 | * @attention |
mbed_official | 237:f3da66175598 | 290 | * |
mbed_official | 237:f3da66175598 | 291 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 237:f3da66175598 | 292 | * |
mbed_official | 237:f3da66175598 | 293 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 237:f3da66175598 | 294 | * are permitted provided that the following conditions are met: |
mbed_official | 237:f3da66175598 | 295 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 237:f3da66175598 | 296 | * this list of conditions and the following disclaimer. |
mbed_official | 237:f3da66175598 | 297 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 237:f3da66175598 | 298 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 237:f3da66175598 | 299 | * and/or other materials provided with the distribution. |
mbed_official | 237:f3da66175598 | 300 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 237:f3da66175598 | 301 | * may be used to endorse or promote products derived from this software |
mbed_official | 237:f3da66175598 | 302 | * without specific prior written permission. |
mbed_official | 237:f3da66175598 | 303 | * |
mbed_official | 237:f3da66175598 | 304 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 237:f3da66175598 | 305 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 237:f3da66175598 | 306 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 237:f3da66175598 | 307 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 237:f3da66175598 | 308 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 237:f3da66175598 | 309 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 237:f3da66175598 | 310 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 237:f3da66175598 | 311 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 237:f3da66175598 | 312 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 237:f3da66175598 | 313 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 237:f3da66175598 | 314 | * |
mbed_official | 237:f3da66175598 | 315 | ****************************************************************************** |
mbed_official | 237:f3da66175598 | 316 | */ |
mbed_official | 237:f3da66175598 | 317 | |
mbed_official | 237:f3da66175598 | 318 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 319 | #include "stm32f3xx_hal.h" |
mbed_official | 237:f3da66175598 | 320 | |
mbed_official | 237:f3da66175598 | 321 | /** @addtogroup STM32F3xx_HAL_Driver |
mbed_official | 237:f3da66175598 | 322 | * @{ |
mbed_official | 237:f3da66175598 | 323 | */ |
mbed_official | 237:f3da66175598 | 324 | |
mbed_official | 237:f3da66175598 | 325 | /** @defgroup HRTIM |
mbed_official | 237:f3da66175598 | 326 | * @brief HRTIM HAL module driver |
mbed_official | 237:f3da66175598 | 327 | * @{ |
mbed_official | 237:f3da66175598 | 328 | */ |
mbed_official | 237:f3da66175598 | 329 | |
mbed_official | 237:f3da66175598 | 330 | #ifdef HAL_HRTIM_MODULE_ENABLED |
mbed_official | 237:f3da66175598 | 331 | |
mbed_official | 237:f3da66175598 | 332 | #if defined(STM32F334x8) |
mbed_official | 237:f3da66175598 | 333 | |
mbed_official | 237:f3da66175598 | 334 | /* Private typedef -----------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 335 | /* Private define ------------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 336 | #define HRTIM_FLTR_FLTxEN (HRTIM_FLTR_FLT1EN |\ |
mbed_official | 237:f3da66175598 | 337 | HRTIM_FLTR_FLT2EN |\ |
mbed_official | 237:f3da66175598 | 338 | HRTIM_FLTR_FLT3EN |\ |
mbed_official | 237:f3da66175598 | 339 | HRTIM_FLTR_FLT4EN | \ |
mbed_official | 237:f3da66175598 | 340 | HRTIM_FLTR_FLT5EN) |
mbed_official | 237:f3da66175598 | 341 | |
mbed_official | 237:f3da66175598 | 342 | #define HRTIM_TIMCR_TIMUPDATETRIGGER (HRTIM_TIMUPDATETRIGGER_MASTER |\ |
mbed_official | 237:f3da66175598 | 343 | HRTIM_TIMUPDATETRIGGER_TIMER_A |\ |
mbed_official | 237:f3da66175598 | 344 | HRTIM_TIMUPDATETRIGGER_TIMER_B |\ |
mbed_official | 237:f3da66175598 | 345 | HRTIM_TIMUPDATETRIGGER_TIMER_C |\ |
mbed_official | 237:f3da66175598 | 346 | HRTIM_TIMUPDATETRIGGER_TIMER_D |\ |
mbed_official | 237:f3da66175598 | 347 | HRTIM_TIMUPDATETRIGGER_TIMER_E) |
mbed_official | 237:f3da66175598 | 348 | |
mbed_official | 237:f3da66175598 | 349 | /* Private macro -------------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 350 | /* Private variables ---------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 351 | static uint32_t TimerIdxToTimerId[] = |
mbed_official | 237:f3da66175598 | 352 | { |
mbed_official | 237:f3da66175598 | 353 | HRTIM_TIMERID_TIMER_A, |
mbed_official | 237:f3da66175598 | 354 | HRTIM_TIMERID_TIMER_B, |
mbed_official | 237:f3da66175598 | 355 | HRTIM_TIMERID_TIMER_C, |
mbed_official | 237:f3da66175598 | 356 | HRTIM_TIMERID_TIMER_D, |
mbed_official | 237:f3da66175598 | 357 | HRTIM_TIMERID_TIMER_E, |
mbed_official | 237:f3da66175598 | 358 | HRTIM_TIMERID_MASTER, |
mbed_official | 237:f3da66175598 | 359 | }; |
mbed_official | 237:f3da66175598 | 360 | |
mbed_official | 237:f3da66175598 | 361 | /* Private function prototypes -----------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 362 | /* Private functions ---------------------------------------------------------*/ |
mbed_official | 237:f3da66175598 | 363 | static void HRTIM_MasterBase_Config(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 364 | HRTIM_TimeBaseCfgTypeDef * pTimeBaseCfg); |
mbed_official | 237:f3da66175598 | 365 | |
mbed_official | 237:f3da66175598 | 366 | static void HRTIM_TimingUnitBase_Config(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 367 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 368 | HRTIM_TimeBaseCfgTypeDef * pTimeBaseCfg); |
mbed_official | 237:f3da66175598 | 369 | |
mbed_official | 237:f3da66175598 | 370 | static void HRTIM_MasterWaveform_Config(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 371 | HRTIM_TimerCfgTypeDef * pTimerCfg); |
mbed_official | 237:f3da66175598 | 372 | |
mbed_official | 237:f3da66175598 | 373 | static void HRTIM_TimingUnitWaveform_Config(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 374 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 375 | HRTIM_TimerCfgTypeDef * pTimerCfg); |
mbed_official | 237:f3da66175598 | 376 | |
mbed_official | 237:f3da66175598 | 377 | static void HRTIM_CompareUnitConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 378 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 379 | uint32_t CompareUnit, |
mbed_official | 237:f3da66175598 | 380 | HRTIM_CompareCfgTypeDef * pCompareCfg); |
mbed_official | 237:f3da66175598 | 381 | |
mbed_official | 237:f3da66175598 | 382 | static void HRTIM_CaptureUnitConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 383 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 384 | uint32_t CaptureUnit, |
mbed_official | 237:f3da66175598 | 385 | uint32_t Event); |
mbed_official | 237:f3da66175598 | 386 | |
mbed_official | 237:f3da66175598 | 387 | static void HRTIM_OutputConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 388 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 389 | uint32_t Output, |
mbed_official | 237:f3da66175598 | 390 | HRTIM_OutputCfgTypeDef * pOutputCfg); |
mbed_official | 237:f3da66175598 | 391 | |
mbed_official | 237:f3da66175598 | 392 | static void HRTIM_EventConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 393 | uint32_t Event, |
mbed_official | 237:f3da66175598 | 394 | HRTIM_EventCfgTypeDef * pEventCfg); |
mbed_official | 237:f3da66175598 | 395 | |
mbed_official | 237:f3da66175598 | 396 | static void HRTIM_TIM_ResetConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 397 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 398 | uint32_t Event); |
mbed_official | 237:f3da66175598 | 399 | |
mbed_official | 237:f3da66175598 | 400 | static uint32_t HRTIM_GetITFromOCMode(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 401 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 402 | uint32_t OCChannel); |
mbed_official | 237:f3da66175598 | 403 | |
mbed_official | 237:f3da66175598 | 404 | static uint32_t HRTIM_GetDMAFromOCMode(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 405 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 406 | uint32_t OCChannel); |
mbed_official | 237:f3da66175598 | 407 | |
mbed_official | 237:f3da66175598 | 408 | static DMA_HandleTypeDef * HRTIM_GetDMAHandleFromTimerIdx(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 409 | uint32_t TimerIdx); |
mbed_official | 237:f3da66175598 | 410 | |
mbed_official | 237:f3da66175598 | 411 | static uint32_t GetTimerIdxFromDMAHandle(DMA_HandleTypeDef *hdma); |
mbed_official | 237:f3da66175598 | 412 | |
mbed_official | 237:f3da66175598 | 413 | static void HRTIM_ForceRegistersUpdate(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 414 | uint32_t TimerIdx); |
mbed_official | 237:f3da66175598 | 415 | |
mbed_official | 237:f3da66175598 | 416 | static void HRTIM_HRTIM_ISR(HRTIM_HandleTypeDef * hhrtim); |
mbed_official | 237:f3da66175598 | 417 | |
mbed_official | 237:f3da66175598 | 418 | static void HRTIM_Master_ISR(HRTIM_HandleTypeDef * hhrtim); |
mbed_official | 237:f3da66175598 | 419 | |
mbed_official | 237:f3da66175598 | 420 | static void HRTIM_Timer_ISR(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 421 | uint32_t TimerIdx); |
mbed_official | 237:f3da66175598 | 422 | |
mbed_official | 237:f3da66175598 | 423 | static void HRTIM_DMAMasterCplt(DMA_HandleTypeDef *hdma); |
mbed_official | 237:f3da66175598 | 424 | |
mbed_official | 237:f3da66175598 | 425 | static void HRTIM_DMATimerxCplt(DMA_HandleTypeDef *hdma); |
mbed_official | 237:f3da66175598 | 426 | |
mbed_official | 237:f3da66175598 | 427 | static void HRTIM_DMAError(DMA_HandleTypeDef *hdma); |
mbed_official | 237:f3da66175598 | 428 | |
mbed_official | 237:f3da66175598 | 429 | static void HRTIM_BurstDMACplt(DMA_HandleTypeDef *hdma); |
mbed_official | 237:f3da66175598 | 430 | |
mbed_official | 237:f3da66175598 | 431 | /** @defgroup HRTIM_Private_Functions |
mbed_official | 237:f3da66175598 | 432 | * @{ |
mbed_official | 237:f3da66175598 | 433 | */ |
mbed_official | 237:f3da66175598 | 434 | |
mbed_official | 237:f3da66175598 | 435 | /** @defgroup HAL_HRTIM_Group1 Initialization and de-initialization functions |
mbed_official | 237:f3da66175598 | 436 | * @brief Initialization and Configuration functions |
mbed_official | 237:f3da66175598 | 437 | * |
mbed_official | 237:f3da66175598 | 438 | @verbatim |
mbed_official | 237:f3da66175598 | 439 | =============================================================================== |
mbed_official | 237:f3da66175598 | 440 | ##### Initialization and Time Base Configuration functions ##### |
mbed_official | 237:f3da66175598 | 441 | =============================================================================== |
mbed_official | 237:f3da66175598 | 442 | [..] This section provides functions allowing to: |
mbed_official | 237:f3da66175598 | 443 | (+) Initialize a HRTIM instance |
mbed_official | 237:f3da66175598 | 444 | (+) De-initialize a HRTIM instance |
mbed_official | 237:f3da66175598 | 445 | (+) Initialize the HRTIM MSP |
mbed_official | 237:f3da66175598 | 446 | (+) De-initialize the HRTIM MSP |
mbed_official | 237:f3da66175598 | 447 | (+) Start the high-resolution unit (start DLL calibration) |
mbed_official | 237:f3da66175598 | 448 | (+) Check that the high resolution unit is ready (DLL calibration done) |
mbed_official | 237:f3da66175598 | 449 | (+) Configure the time base unit of a HRTIM timer |
mbed_official | 237:f3da66175598 | 450 | |
mbed_official | 237:f3da66175598 | 451 | @endverbatim |
mbed_official | 237:f3da66175598 | 452 | * @{ |
mbed_official | 237:f3da66175598 | 453 | */ |
mbed_official | 237:f3da66175598 | 454 | |
mbed_official | 237:f3da66175598 | 455 | /** |
mbed_official | 237:f3da66175598 | 456 | * @brief Initializes a HRTIM instance |
mbed_official | 237:f3da66175598 | 457 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 458 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 459 | */ |
mbed_official | 237:f3da66175598 | 460 | HAL_StatusTypeDef HAL_HRTIM_Init(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 461 | { |
mbed_official | 237:f3da66175598 | 462 | uint8_t timer_idx; |
mbed_official | 237:f3da66175598 | 463 | uint32_t hrtim_mcr; |
mbed_official | 237:f3da66175598 | 464 | |
mbed_official | 237:f3da66175598 | 465 | /* Check the HRTIM handle allocation */ |
mbed_official | 237:f3da66175598 | 466 | if(hhrtim == NULL) |
mbed_official | 237:f3da66175598 | 467 | { |
mbed_official | 237:f3da66175598 | 468 | return HAL_ERROR; |
mbed_official | 237:f3da66175598 | 469 | } |
mbed_official | 237:f3da66175598 | 470 | |
mbed_official | 237:f3da66175598 | 471 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 472 | assert_param(IS_HRTIM_ALL_INSTANCE(hhrtim->Instance)); |
mbed_official | 237:f3da66175598 | 473 | assert_param(IS_HRTIM_IT(hhrtim->Init.HRTIMInterruptResquests)); |
mbed_official | 237:f3da66175598 | 474 | |
mbed_official | 237:f3da66175598 | 475 | /* Set the HRTIM state */ |
mbed_official | 237:f3da66175598 | 476 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 477 | |
mbed_official | 237:f3da66175598 | 478 | /* Initialize the DMA handles */ |
mbed_official | 237:f3da66175598 | 479 | hhrtim->hdmaMaster = (DMA_HandleTypeDef *)NULL; |
mbed_official | 237:f3da66175598 | 480 | hhrtim->hdmaTimerA = (DMA_HandleTypeDef *)NULL; |
mbed_official | 237:f3da66175598 | 481 | hhrtim->hdmaTimerB = (DMA_HandleTypeDef *)NULL; |
mbed_official | 237:f3da66175598 | 482 | hhrtim->hdmaTimerC = (DMA_HandleTypeDef *)NULL; |
mbed_official | 237:f3da66175598 | 483 | hhrtim->hdmaTimerD = (DMA_HandleTypeDef *)NULL; |
mbed_official | 237:f3da66175598 | 484 | hhrtim->hdmaTimerE = (DMA_HandleTypeDef *)NULL; |
mbed_official | 237:f3da66175598 | 485 | |
mbed_official | 237:f3da66175598 | 486 | /* HRTIM output synchronization configuration (if required) */ |
mbed_official | 237:f3da66175598 | 487 | if ((hhrtim->Init.SyncOptions & HRTIM_SYNCOPTION_MASTER) != RESET) |
mbed_official | 237:f3da66175598 | 488 | { |
mbed_official | 237:f3da66175598 | 489 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 490 | assert_param(IS_HRTIM_SYNCOUTPUTSOURCE(hhrtim->Init.SyncOutputSource)); |
mbed_official | 237:f3da66175598 | 491 | assert_param(IS_HRTIM_SYNCOUTPUTPOLARITY(hhrtim->Init.SyncOutputPolarity)); |
mbed_official | 237:f3da66175598 | 492 | |
mbed_official | 237:f3da66175598 | 493 | /* The synchronization output initialization procedure must be done prior |
mbed_official | 237:f3da66175598 | 494 | to the configuration of the MCU outputs (done within HAL_HRTIM_MspInit) |
mbed_official | 237:f3da66175598 | 495 | */ |
mbed_official | 237:f3da66175598 | 496 | if (hhrtim->Instance == HRTIM1) |
mbed_official | 237:f3da66175598 | 497 | { |
mbed_official | 237:f3da66175598 | 498 | /* Enable the HRTIM peripheral clock */ |
mbed_official | 237:f3da66175598 | 499 | __HRTIM1_CLK_ENABLE(); |
mbed_official | 237:f3da66175598 | 500 | } |
mbed_official | 237:f3da66175598 | 501 | |
mbed_official | 237:f3da66175598 | 502 | hrtim_mcr = hhrtim->Instance->sMasterRegs.MCR; |
mbed_official | 237:f3da66175598 | 503 | |
mbed_official | 237:f3da66175598 | 504 | /* Set the event to be sent on the synchronization output */ |
mbed_official | 237:f3da66175598 | 505 | hrtim_mcr &= ~(HRTIM_MCR_SYNC_SRC); |
mbed_official | 237:f3da66175598 | 506 | hrtim_mcr |= (hhrtim->Init.SyncOutputSource & HRTIM_MCR_SYNC_SRC); |
mbed_official | 237:f3da66175598 | 507 | |
mbed_official | 237:f3da66175598 | 508 | /* Set the polarity of the synchronization output */ |
mbed_official | 237:f3da66175598 | 509 | hrtim_mcr &= ~(HRTIM_MCR_SYNC_OUT); |
mbed_official | 237:f3da66175598 | 510 | hrtim_mcr |= (hhrtim->Init.SyncOutputPolarity & HRTIM_MCR_SYNC_OUT); |
mbed_official | 237:f3da66175598 | 511 | |
mbed_official | 237:f3da66175598 | 512 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 513 | hhrtim->Instance->sMasterRegs.MCR = hrtim_mcr; |
mbed_official | 237:f3da66175598 | 514 | } |
mbed_official | 237:f3da66175598 | 515 | |
mbed_official | 237:f3da66175598 | 516 | /* Init the low level hardware : GPIO, CLOCK, NVIC and DMA */ |
mbed_official | 237:f3da66175598 | 517 | HAL_HRTIM_MspInit(hhrtim); |
mbed_official | 237:f3da66175598 | 518 | |
mbed_official | 237:f3da66175598 | 519 | /* HRTIM input synchronization configuration (if required) */ |
mbed_official | 237:f3da66175598 | 520 | if ((hhrtim->Init.SyncOptions & HRTIM_SYNCOPTION_SLAVE) != RESET) |
mbed_official | 237:f3da66175598 | 521 | { |
mbed_official | 237:f3da66175598 | 522 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 523 | assert_param(IS_HRTIM_SYNCINPUTSOURCE(hhrtim->Init.SyncInputSource)); |
mbed_official | 237:f3da66175598 | 524 | |
mbed_official | 237:f3da66175598 | 525 | hrtim_mcr = hhrtim->Instance->sMasterRegs.MCR; |
mbed_official | 237:f3da66175598 | 526 | |
mbed_official | 237:f3da66175598 | 527 | /* Set the synchronization input source */ |
mbed_official | 237:f3da66175598 | 528 | hrtim_mcr &= ~(HRTIM_MCR_SYNC_IN); |
mbed_official | 237:f3da66175598 | 529 | hrtim_mcr |= (hhrtim->Init.SyncInputSource & HRTIM_MCR_SYNC_IN); |
mbed_official | 237:f3da66175598 | 530 | |
mbed_official | 237:f3da66175598 | 531 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 532 | hhrtim->Instance->sMasterRegs.MCR = hrtim_mcr; |
mbed_official | 237:f3da66175598 | 533 | } |
mbed_official | 237:f3da66175598 | 534 | |
mbed_official | 237:f3da66175598 | 535 | /* Initialize the HRTIM state*/ |
mbed_official | 237:f3da66175598 | 536 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 537 | |
mbed_official | 237:f3da66175598 | 538 | /* Initialize the lock status of the HRTIM HAL API */ |
mbed_official | 237:f3da66175598 | 539 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 540 | |
mbed_official | 237:f3da66175598 | 541 | /* Tnitialize timer related parameters */ |
mbed_official | 237:f3da66175598 | 542 | for (timer_idx = HRTIM_TIMERINDEX_TIMER_A ; |
mbed_official | 237:f3da66175598 | 543 | timer_idx <= HRTIM_TIMERINDEX_MASTER ; |
mbed_official | 237:f3da66175598 | 544 | timer_idx++) |
mbed_official | 237:f3da66175598 | 545 | { |
mbed_official | 237:f3da66175598 | 546 | hhrtim->TimerParam[timer_idx].CaptureTrigger1 = HRTIM_CAPTURETRIGGER_NONE; |
mbed_official | 237:f3da66175598 | 547 | hhrtim->TimerParam[timer_idx].CaptureTrigger2 = HRTIM_CAPTURETRIGGER_NONE; |
mbed_official | 237:f3da66175598 | 548 | hhrtim->TimerParam[timer_idx].InterruptRequests = HRTIM_IT_NONE; |
mbed_official | 237:f3da66175598 | 549 | hhrtim->TimerParam[timer_idx].DMARequests = HRTIM_IT_NONE; |
mbed_official | 237:f3da66175598 | 550 | hhrtim->TimerParam[timer_idx].DMASrcAddress = 0; |
mbed_official | 237:f3da66175598 | 551 | hhrtim->TimerParam[timer_idx].DMASize = 0; |
mbed_official | 237:f3da66175598 | 552 | } |
mbed_official | 237:f3da66175598 | 553 | |
mbed_official | 237:f3da66175598 | 554 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 555 | } |
mbed_official | 237:f3da66175598 | 556 | |
mbed_official | 237:f3da66175598 | 557 | /** |
mbed_official | 237:f3da66175598 | 558 | * @brief De-initializes a timer operating in waveform mode |
mbed_official | 237:f3da66175598 | 559 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 560 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 561 | */ |
mbed_official | 237:f3da66175598 | 562 | HAL_StatusTypeDef HAL_HRTIM_DeInit (HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 563 | { |
mbed_official | 237:f3da66175598 | 564 | /* Check the HRTIM handle allocation */ |
mbed_official | 237:f3da66175598 | 565 | if(hhrtim == NULL) |
mbed_official | 237:f3da66175598 | 566 | { |
mbed_official | 237:f3da66175598 | 567 | return HAL_ERROR; |
mbed_official | 237:f3da66175598 | 568 | } |
mbed_official | 237:f3da66175598 | 569 | |
mbed_official | 237:f3da66175598 | 570 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 571 | assert_param(IS_HRTIM_ALL_INSTANCE(hhrtim->Instance)); |
mbed_official | 237:f3da66175598 | 572 | |
mbed_official | 237:f3da66175598 | 573 | /* Set the HRTIM state */ |
mbed_official | 237:f3da66175598 | 574 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 575 | |
mbed_official | 237:f3da66175598 | 576 | /* DeInit the low level hardware */ |
mbed_official | 237:f3da66175598 | 577 | HAL_HRTIM_MspDeInit(hhrtim); |
mbed_official | 237:f3da66175598 | 578 | |
mbed_official | 237:f3da66175598 | 579 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 580 | |
mbed_official | 237:f3da66175598 | 581 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 582 | } |
mbed_official | 237:f3da66175598 | 583 | |
mbed_official | 237:f3da66175598 | 584 | /** |
mbed_official | 237:f3da66175598 | 585 | * @brief MSP initialization for a HRTIM instance |
mbed_official | 237:f3da66175598 | 586 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 587 | * @retval None |
mbed_official | 237:f3da66175598 | 588 | */ |
mbed_official | 237:f3da66175598 | 589 | __weak void HAL_HRTIM_MspInit(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 590 | { |
mbed_official | 237:f3da66175598 | 591 | /* NOTE: This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 592 | the HAL_HRTIM_MspInit could be implemented in the user file |
mbed_official | 237:f3da66175598 | 593 | */ |
mbed_official | 237:f3da66175598 | 594 | } |
mbed_official | 237:f3da66175598 | 595 | |
mbed_official | 237:f3da66175598 | 596 | /** |
mbed_official | 237:f3da66175598 | 597 | * @brief MSP initialization for a for a HRTIM instance |
mbed_official | 237:f3da66175598 | 598 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 599 | * @retval None |
mbed_official | 237:f3da66175598 | 600 | */ |
mbed_official | 237:f3da66175598 | 601 | __weak void HAL_HRTIM_MspDeInit(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 602 | { |
mbed_official | 237:f3da66175598 | 603 | /* NOTE: This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 604 | the HAL_HRTIM_MspDeInit could be implemented in the user file |
mbed_official | 237:f3da66175598 | 605 | */ |
mbed_official | 237:f3da66175598 | 606 | } |
mbed_official | 237:f3da66175598 | 607 | |
mbed_official | 237:f3da66175598 | 608 | /** |
mbed_official | 237:f3da66175598 | 609 | * @brief Starts the DLL calibration |
mbed_official | 237:f3da66175598 | 610 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 611 | * @param CalibrationRate: DLL calibration period |
mbed_official | 237:f3da66175598 | 612 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 613 | * @arg HRTIM_SINGLE_CALIBRATION: One shot DLL calibration |
mbed_official | 237:f3da66175598 | 614 | * @arg HRTIM_CALIBRATIONRATE_7300: Periodic DLL calibration. T=7.3 ms |
mbed_official | 237:f3da66175598 | 615 | * @arg HRTIM_CALIBRATIONRATE_910: Periodic DLL calibration. T=910 us |
mbed_official | 237:f3da66175598 | 616 | * @arg HRTIM_CALIBRATIONRATE_114: Periodic DLL calibration. T=114 us |
mbed_official | 237:f3da66175598 | 617 | * @arg HRTIM_CALIBRATIONRATE_14: Periodic DLL calibration. T=14 us |
mbed_official | 237:f3da66175598 | 618 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 619 | * @note This function locks the HRTIM instance. HRTIM instance is unlocked |
mbed_official | 237:f3da66175598 | 620 | * within the HAL_HRTIM_PollForDLLCalibration function, just before |
mbed_official | 237:f3da66175598 | 621 | * exiting the function. |
mbed_official | 237:f3da66175598 | 622 | */ |
mbed_official | 237:f3da66175598 | 623 | HAL_StatusTypeDef HAL_HRTIM_DLLCalibrationStart(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 624 | uint32_t CalibrationRate) |
mbed_official | 237:f3da66175598 | 625 | { |
mbed_official | 237:f3da66175598 | 626 | uint32_t hrtim_dllcr; |
mbed_official | 237:f3da66175598 | 627 | |
mbed_official | 237:f3da66175598 | 628 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 629 | assert_param(IS_HRTIM_CALIBRATIONRATE(CalibrationRate)); |
mbed_official | 237:f3da66175598 | 630 | |
mbed_official | 237:f3da66175598 | 631 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 632 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 633 | |
mbed_official | 237:f3da66175598 | 634 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 635 | |
mbed_official | 237:f3da66175598 | 636 | /* Configure DLL Calibration */ |
mbed_official | 237:f3da66175598 | 637 | hrtim_dllcr = hhrtim->Instance->sCommonRegs.DLLCR; |
mbed_official | 237:f3da66175598 | 638 | |
mbed_official | 237:f3da66175598 | 639 | if (CalibrationRate == HRTIM_SINGLE_CALIBRATION) |
mbed_official | 237:f3da66175598 | 640 | { |
mbed_official | 237:f3da66175598 | 641 | /* One shot DLL calibration */ |
mbed_official | 237:f3da66175598 | 642 | hrtim_dllcr &= ~(HRTIM_DLLCR_CALEN); |
mbed_official | 237:f3da66175598 | 643 | hrtim_dllcr |= HRTIM_DLLCR_CAL; |
mbed_official | 237:f3da66175598 | 644 | } |
mbed_official | 237:f3da66175598 | 645 | else |
mbed_official | 237:f3da66175598 | 646 | { |
mbed_official | 237:f3da66175598 | 647 | /* Periodic DLL calibration */ |
mbed_official | 237:f3da66175598 | 648 | hrtim_dllcr &= ~(HRTIM_DLLCR_CALRTE | HRTIM_DLLCR_CAL); |
mbed_official | 237:f3da66175598 | 649 | hrtim_dllcr |= (CalibrationRate | HRTIM_DLLCR_CALEN); |
mbed_official | 237:f3da66175598 | 650 | } |
mbed_official | 237:f3da66175598 | 651 | |
mbed_official | 237:f3da66175598 | 652 | /* Update HRTIM register */ |
mbed_official | 237:f3da66175598 | 653 | hhrtim->Instance->sCommonRegs.DLLCR = hrtim_dllcr; |
mbed_official | 237:f3da66175598 | 654 | |
mbed_official | 237:f3da66175598 | 655 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 656 | } |
mbed_official | 237:f3da66175598 | 657 | |
mbed_official | 237:f3da66175598 | 658 | /** |
mbed_official | 237:f3da66175598 | 659 | * @brief Starts the DLL calibration |
mbed_official | 237:f3da66175598 | 660 | * DLL ready interrupt is enabled |
mbed_official | 237:f3da66175598 | 661 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 662 | * @param CalibrationRate: DLL calibration period |
mbed_official | 237:f3da66175598 | 663 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 664 | * @arg HRTIM_SINGLE_CALIBRATION: One shot DLL calibration |
mbed_official | 237:f3da66175598 | 665 | * @arg HRTIM_CALIBRATIONRATE_7300: Periodic DLL calibration. T=7.3 ms |
mbed_official | 237:f3da66175598 | 666 | * @arg HRTIM_CALIBRATIONRATE_910: Periodic DLL calibration. T=910 us |
mbed_official | 237:f3da66175598 | 667 | * @arg HRTIM_CALIBRATIONRATE_114: Periodic DLL calibration. T=114 us |
mbed_official | 237:f3da66175598 | 668 | * @arg HRTIM_CALIBRATIONRATE_14: Periodic DLL calibration. T=14 us |
mbed_official | 237:f3da66175598 | 669 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 670 | * @note This function locks the HRTIM instance. HRTIM instance is unlocked |
mbed_official | 237:f3da66175598 | 671 | * within the IRQ processing function when processing the DLL ready |
mbed_official | 237:f3da66175598 | 672 | * interrupt. |
mbed_official | 237:f3da66175598 | 673 | * @note If this function is called for periodic calibration, the DLLRDY |
mbed_official | 237:f3da66175598 | 674 | * interrupt is generated every time the calibration completes which |
mbed_official | 237:f3da66175598 | 675 | * will significantly increases the overall interrupt rate. |
mbed_official | 237:f3da66175598 | 676 | */ |
mbed_official | 237:f3da66175598 | 677 | HAL_StatusTypeDef HAL_HRTIM_DLLCalibrationStart_IT(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 678 | uint32_t CalibrationRate) |
mbed_official | 237:f3da66175598 | 679 | { |
mbed_official | 237:f3da66175598 | 680 | uint32_t hrtim_dllcr; |
mbed_official | 237:f3da66175598 | 681 | |
mbed_official | 237:f3da66175598 | 682 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 683 | assert_param(IS_HRTIM_CALIBRATIONRATE(CalibrationRate)); |
mbed_official | 237:f3da66175598 | 684 | |
mbed_official | 237:f3da66175598 | 685 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 686 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 687 | |
mbed_official | 237:f3da66175598 | 688 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 689 | |
mbed_official | 237:f3da66175598 | 690 | /* Enable DLL Ready interrupt flag */ |
mbed_official | 237:f3da66175598 | 691 | __HAL_HRTIM_ENABLE_IT(hhrtim, HRTIM_IT_DLLRDY); |
mbed_official | 237:f3da66175598 | 692 | |
mbed_official | 237:f3da66175598 | 693 | /* Configure DLL Calibration */ |
mbed_official | 237:f3da66175598 | 694 | hrtim_dllcr = hhrtim->Instance->sCommonRegs.DLLCR; |
mbed_official | 237:f3da66175598 | 695 | |
mbed_official | 237:f3da66175598 | 696 | if (CalibrationRate == HRTIM_SINGLE_CALIBRATION) |
mbed_official | 237:f3da66175598 | 697 | { |
mbed_official | 237:f3da66175598 | 698 | /* One shot DLL calibration */ |
mbed_official | 237:f3da66175598 | 699 | hrtim_dllcr &= ~(HRTIM_DLLCR_CALEN); |
mbed_official | 237:f3da66175598 | 700 | hrtim_dllcr |= HRTIM_DLLCR_CAL; |
mbed_official | 237:f3da66175598 | 701 | } |
mbed_official | 237:f3da66175598 | 702 | else |
mbed_official | 237:f3da66175598 | 703 | { |
mbed_official | 237:f3da66175598 | 704 | /* Periodic DLL calibration */ |
mbed_official | 237:f3da66175598 | 705 | hrtim_dllcr &= ~(HRTIM_DLLCR_CALRTE | HRTIM_DLLCR_CAL); |
mbed_official | 237:f3da66175598 | 706 | hrtim_dllcr |= (CalibrationRate | HRTIM_DLLCR_CALEN); |
mbed_official | 237:f3da66175598 | 707 | } |
mbed_official | 237:f3da66175598 | 708 | |
mbed_official | 237:f3da66175598 | 709 | /* Update HRTIM register */ |
mbed_official | 237:f3da66175598 | 710 | hhrtim->Instance->sCommonRegs.DLLCR = hrtim_dllcr; |
mbed_official | 237:f3da66175598 | 711 | |
mbed_official | 237:f3da66175598 | 712 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 713 | } |
mbed_official | 237:f3da66175598 | 714 | |
mbed_official | 237:f3da66175598 | 715 | /** |
mbed_official | 237:f3da66175598 | 716 | * @brief Polls the DLL calibration ready flag and returns when the flag is |
mbed_official | 237:f3da66175598 | 717 | * set (DLL calibration completed) or upon timeout expiration |
mbed_official | 237:f3da66175598 | 718 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 719 | * @param Timeout: Timeout duration in millisecond |
mbed_official | 237:f3da66175598 | 720 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 721 | */ |
mbed_official | 237:f3da66175598 | 722 | HAL_StatusTypeDef HAL_HRTIM_PollForDLLCalibration(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 723 | uint32_t Timeout) |
mbed_official | 237:f3da66175598 | 724 | { |
mbed_official | 237:f3da66175598 | 725 | uint32_t tickstart=0; |
mbed_official | 237:f3da66175598 | 726 | |
mbed_official | 237:f3da66175598 | 727 | tickstart = HAL_GetTick(); |
mbed_official | 237:f3da66175598 | 728 | |
mbed_official | 237:f3da66175598 | 729 | /* Check End of conversion flag */ |
mbed_official | 237:f3da66175598 | 730 | while(__HAL_HRTIM_GET_FLAG(hhrtim, HRTIM_IT_DLLRDY) == RESET) |
mbed_official | 237:f3da66175598 | 731 | { |
mbed_official | 237:f3da66175598 | 732 | if (Timeout != HAL_MAX_DELAY) |
mbed_official | 237:f3da66175598 | 733 | { |
mbed_official | 237:f3da66175598 | 734 | if((Timeout == 0) || ((HAL_GetTick()-tickstart) > Timeout)) |
mbed_official | 237:f3da66175598 | 735 | { |
mbed_official | 237:f3da66175598 | 736 | hhrtim->State = HAL_HRTIM_STATE_ERROR; |
mbed_official | 237:f3da66175598 | 737 | return HAL_TIMEOUT; |
mbed_official | 237:f3da66175598 | 738 | } |
mbed_official | 237:f3da66175598 | 739 | } |
mbed_official | 237:f3da66175598 | 740 | } |
mbed_official | 237:f3da66175598 | 741 | |
mbed_official | 237:f3da66175598 | 742 | /* Set HRTIM State */ |
mbed_official | 237:f3da66175598 | 743 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 744 | |
mbed_official | 237:f3da66175598 | 745 | /* Process unlocked */ |
mbed_official | 237:f3da66175598 | 746 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 747 | |
mbed_official | 237:f3da66175598 | 748 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 749 | } |
mbed_official | 237:f3da66175598 | 750 | |
mbed_official | 237:f3da66175598 | 751 | /** |
mbed_official | 237:f3da66175598 | 752 | * @brief Configures the time base unit of a timer |
mbed_official | 237:f3da66175598 | 753 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 754 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 755 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 756 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 757 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 758 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 759 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 760 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 761 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 762 | * @param pTimeBaseCfg: pointer to the time base configuration structure |
mbed_official | 237:f3da66175598 | 763 | * @note This function must be called prior starting the timer |
mbed_official | 237:f3da66175598 | 764 | * @note The time-base unit initialization parameters specify: |
mbed_official | 237:f3da66175598 | 765 | * The timer counter operating mode (continuous, one shot) |
mbed_official | 237:f3da66175598 | 766 | * The timer clock prescaler |
mbed_official | 237:f3da66175598 | 767 | * The timer period |
mbed_official | 237:f3da66175598 | 768 | * The timer repetition counter. |
mbed_official | 237:f3da66175598 | 769 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 770 | */ |
mbed_official | 237:f3da66175598 | 771 | HAL_StatusTypeDef HAL_HRTIM_TimeBaseConfig(HRTIM_HandleTypeDef *hhrtim, |
mbed_official | 237:f3da66175598 | 772 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 773 | HRTIM_TimeBaseCfgTypeDef * pTimeBaseCfg) |
mbed_official | 237:f3da66175598 | 774 | { |
mbed_official | 237:f3da66175598 | 775 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 776 | assert_param(IS_HRTIM_TIMERINDEX(TimerIdx)); |
mbed_official | 237:f3da66175598 | 777 | assert_param(IS_HRTIM_PRESCALERRATIO(pTimeBaseCfg->PrescalerRatio)); |
mbed_official | 237:f3da66175598 | 778 | assert_param(IS_HRTIM_MODE(pTimeBaseCfg->Mode)); |
mbed_official | 237:f3da66175598 | 779 | |
mbed_official | 237:f3da66175598 | 780 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 781 | { |
mbed_official | 237:f3da66175598 | 782 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 783 | } |
mbed_official | 237:f3da66175598 | 784 | |
mbed_official | 237:f3da66175598 | 785 | /* Set the HRTIM state */ |
mbed_official | 237:f3da66175598 | 786 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 787 | |
mbed_official | 237:f3da66175598 | 788 | if (TimerIdx == HRTIM_TIMERINDEX_MASTER) |
mbed_official | 237:f3da66175598 | 789 | { |
mbed_official | 237:f3da66175598 | 790 | /* Configure master timer time base unit */ |
mbed_official | 237:f3da66175598 | 791 | HRTIM_MasterBase_Config(hhrtim, pTimeBaseCfg); |
mbed_official | 237:f3da66175598 | 792 | } |
mbed_official | 237:f3da66175598 | 793 | else |
mbed_official | 237:f3da66175598 | 794 | { |
mbed_official | 237:f3da66175598 | 795 | /* Configure timing unit time base unit */ |
mbed_official | 237:f3da66175598 | 796 | HRTIM_TimingUnitBase_Config(hhrtim, TimerIdx, pTimeBaseCfg); |
mbed_official | 237:f3da66175598 | 797 | } |
mbed_official | 237:f3da66175598 | 798 | |
mbed_official | 237:f3da66175598 | 799 | /* Set HRTIM state */ |
mbed_official | 237:f3da66175598 | 800 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 801 | |
mbed_official | 237:f3da66175598 | 802 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 803 | } |
mbed_official | 237:f3da66175598 | 804 | |
mbed_official | 237:f3da66175598 | 805 | /** |
mbed_official | 237:f3da66175598 | 806 | * @} |
mbed_official | 237:f3da66175598 | 807 | */ |
mbed_official | 237:f3da66175598 | 808 | |
mbed_official | 237:f3da66175598 | 809 | /** @defgroup HAL_HRTIM_Group2 Simple time base mode functions |
mbed_official | 237:f3da66175598 | 810 | * @brief When à HRTIM timer operates in simple time base mode, the |
mbed_official | 237:f3da66175598 | 811 | * timer counter counts from 0 to the period value. |
mbed_official | 237:f3da66175598 | 812 | * |
mbed_official | 237:f3da66175598 | 813 | @verbatim |
mbed_official | 237:f3da66175598 | 814 | =============================================================================== |
mbed_official | 237:f3da66175598 | 815 | ##### Simple time base mode functions ##### |
mbed_official | 237:f3da66175598 | 816 | =============================================================================== |
mbed_official | 237:f3da66175598 | 817 | [..] This section provides functions allowing to: |
mbed_official | 237:f3da66175598 | 818 | (+) Start simple time base |
mbed_official | 237:f3da66175598 | 819 | (+) Stop simple time base |
mbed_official | 237:f3da66175598 | 820 | (+) Start simple time base and enable interrupt |
mbed_official | 237:f3da66175598 | 821 | (+) Stop simple time base and disable interrupt |
mbed_official | 237:f3da66175598 | 822 | (+) Start simple time base and enable DMA transfer |
mbed_official | 237:f3da66175598 | 823 | (+) Stop simple time base and disable DMA transfer |
mbed_official | 237:f3da66175598 | 824 | |
mbed_official | 237:f3da66175598 | 825 | @endverbatim |
mbed_official | 237:f3da66175598 | 826 | * @{ |
mbed_official | 237:f3da66175598 | 827 | */ |
mbed_official | 237:f3da66175598 | 828 | |
mbed_official | 237:f3da66175598 | 829 | /** |
mbed_official | 237:f3da66175598 | 830 | * @brief Starts the counter of a timer operating in basic time base mode |
mbed_official | 237:f3da66175598 | 831 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 832 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 833 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 834 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 835 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 836 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 837 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 838 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 839 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 840 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 841 | */ |
mbed_official | 237:f3da66175598 | 842 | HAL_StatusTypeDef HAL_HRTIM_SimpleBaseStart(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 843 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 844 | { |
mbed_official | 237:f3da66175598 | 845 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 846 | assert_param(IS_HRTIM_TIMERINDEX(TimerIdx)); |
mbed_official | 237:f3da66175598 | 847 | |
mbed_official | 237:f3da66175598 | 848 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 849 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 850 | |
mbed_official | 237:f3da66175598 | 851 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 852 | |
mbed_official | 237:f3da66175598 | 853 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 854 | __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 855 | |
mbed_official | 237:f3da66175598 | 856 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 857 | |
mbed_official | 237:f3da66175598 | 858 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 859 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 860 | |
mbed_official | 237:f3da66175598 | 861 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 862 | } |
mbed_official | 237:f3da66175598 | 863 | |
mbed_official | 237:f3da66175598 | 864 | /** |
mbed_official | 237:f3da66175598 | 865 | * @brief Stops the counter of a timer operating in basic time base mode |
mbed_official | 237:f3da66175598 | 866 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 867 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 868 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 869 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 870 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 871 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 872 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 873 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 874 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 875 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 876 | */ |
mbed_official | 237:f3da66175598 | 877 | HAL_StatusTypeDef HAL_HRTIM_SimpleBaseStop(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 878 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 879 | { |
mbed_official | 237:f3da66175598 | 880 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 881 | assert_param(IS_HRTIM_TIMERINDEX(TimerIdx)); |
mbed_official | 237:f3da66175598 | 882 | |
mbed_official | 237:f3da66175598 | 883 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 884 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 885 | |
mbed_official | 237:f3da66175598 | 886 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 887 | |
mbed_official | 237:f3da66175598 | 888 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 889 | __HAL_HRTIM_DISABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 890 | |
mbed_official | 237:f3da66175598 | 891 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 892 | |
mbed_official | 237:f3da66175598 | 893 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 894 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 895 | |
mbed_official | 237:f3da66175598 | 896 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 897 | } |
mbed_official | 237:f3da66175598 | 898 | |
mbed_official | 237:f3da66175598 | 899 | /** |
mbed_official | 237:f3da66175598 | 900 | * @brief Starts the counter of a timer operating in basic time base mode |
mbed_official | 237:f3da66175598 | 901 | * Timer repetition interrupt is enabled. |
mbed_official | 237:f3da66175598 | 902 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 903 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 904 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 905 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 906 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 907 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 908 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 909 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 910 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 911 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 912 | */ |
mbed_official | 237:f3da66175598 | 913 | HAL_StatusTypeDef HAL_HRTIM_SimpleBaseStart_IT(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 914 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 915 | { |
mbed_official | 237:f3da66175598 | 916 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 917 | assert_param(IS_HRTIM_TIMERINDEX(TimerIdx)); |
mbed_official | 237:f3da66175598 | 918 | |
mbed_official | 237:f3da66175598 | 919 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 920 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 921 | |
mbed_official | 237:f3da66175598 | 922 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 923 | |
mbed_official | 237:f3da66175598 | 924 | /* Enable the repetition interrupt */ |
mbed_official | 237:f3da66175598 | 925 | if (TimerIdx == HRTIM_TIMERINDEX_MASTER) |
mbed_official | 237:f3da66175598 | 926 | { |
mbed_official | 237:f3da66175598 | 927 | __HAL_HRTIM_MASTER_ENABLE_IT(hhrtim, HRTIM_MASTER_IT_MREP); |
mbed_official | 237:f3da66175598 | 928 | } |
mbed_official | 237:f3da66175598 | 929 | else |
mbed_official | 237:f3da66175598 | 930 | { |
mbed_official | 237:f3da66175598 | 931 | __HAL_HRTIM_TIMER_ENABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_REP); |
mbed_official | 237:f3da66175598 | 932 | } |
mbed_official | 237:f3da66175598 | 933 | |
mbed_official | 237:f3da66175598 | 934 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 935 | __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 936 | |
mbed_official | 237:f3da66175598 | 937 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 938 | |
mbed_official | 237:f3da66175598 | 939 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 940 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 941 | |
mbed_official | 237:f3da66175598 | 942 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 943 | } |
mbed_official | 237:f3da66175598 | 944 | |
mbed_official | 237:f3da66175598 | 945 | /** |
mbed_official | 237:f3da66175598 | 946 | * @brief Starts the counter of a timer operating in basic time base mode |
mbed_official | 237:f3da66175598 | 947 | * Timer repetition interrupt is disabled. |
mbed_official | 237:f3da66175598 | 948 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 949 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 950 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 951 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 952 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 953 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 954 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 955 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 956 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 957 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 958 | */ |
mbed_official | 237:f3da66175598 | 959 | HAL_StatusTypeDef HAL_HRTIM_SimpleBaseStop_IT(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 960 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 961 | { |
mbed_official | 237:f3da66175598 | 962 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 963 | assert_param(IS_HRTIM_TIMERINDEX(TimerIdx)); |
mbed_official | 237:f3da66175598 | 964 | |
mbed_official | 237:f3da66175598 | 965 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 966 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 967 | |
mbed_official | 237:f3da66175598 | 968 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 969 | |
mbed_official | 237:f3da66175598 | 970 | /* Disable the repetition interrupt */ |
mbed_official | 237:f3da66175598 | 971 | if (TimerIdx == HRTIM_TIMERINDEX_MASTER) |
mbed_official | 237:f3da66175598 | 972 | { |
mbed_official | 237:f3da66175598 | 973 | __HAL_HRTIM_MASTER_DISABLE_IT(hhrtim, HRTIM_MASTER_IT_MREP); |
mbed_official | 237:f3da66175598 | 974 | } |
mbed_official | 237:f3da66175598 | 975 | else |
mbed_official | 237:f3da66175598 | 976 | { |
mbed_official | 237:f3da66175598 | 977 | __HAL_HRTIM_TIMER_DISABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_REP); |
mbed_official | 237:f3da66175598 | 978 | } |
mbed_official | 237:f3da66175598 | 979 | |
mbed_official | 237:f3da66175598 | 980 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 981 | __HAL_HRTIM_DISABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 982 | |
mbed_official | 237:f3da66175598 | 983 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 984 | |
mbed_official | 237:f3da66175598 | 985 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 986 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 987 | |
mbed_official | 237:f3da66175598 | 988 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 989 | } |
mbed_official | 237:f3da66175598 | 990 | |
mbed_official | 237:f3da66175598 | 991 | /** |
mbed_official | 237:f3da66175598 | 992 | * @brief Starts the counter of a timer operating in basic time base mode |
mbed_official | 237:f3da66175598 | 993 | * Timer repetition DMA request is enabled. |
mbed_official | 237:f3da66175598 | 994 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 995 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 996 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 997 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 998 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 999 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 1000 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 1001 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 1002 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 1003 | * @param SrcAddr: DMA transfer source address |
mbed_official | 237:f3da66175598 | 1004 | * @param DestAddr: DMA transfer destination address |
mbed_official | 237:f3da66175598 | 1005 | * @param Length: The length of data items (data size) to be transferred |
mbed_official | 237:f3da66175598 | 1006 | * from source to destination |
mbed_official | 237:f3da66175598 | 1007 | */ |
mbed_official | 237:f3da66175598 | 1008 | HAL_StatusTypeDef HAL_HRTIM_SimpleBaseStart_DMA(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 1009 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 1010 | uint32_t SrcAddr, |
mbed_official | 237:f3da66175598 | 1011 | uint32_t DestAddr, |
mbed_official | 237:f3da66175598 | 1012 | uint32_t Length) |
mbed_official | 237:f3da66175598 | 1013 | { |
mbed_official | 237:f3da66175598 | 1014 | DMA_HandleTypeDef * hdma; |
mbed_official | 237:f3da66175598 | 1015 | |
mbed_official | 237:f3da66175598 | 1016 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 1017 | assert_param(IS_HRTIM_TIMERINDEX(TimerIdx)); |
mbed_official | 237:f3da66175598 | 1018 | |
mbed_official | 237:f3da66175598 | 1019 | if((hhrtim->State == HAL_HRTIM_STATE_BUSY)) |
mbed_official | 237:f3da66175598 | 1020 | { |
mbed_official | 237:f3da66175598 | 1021 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 1022 | } |
mbed_official | 237:f3da66175598 | 1023 | if((hhrtim->State == HAL_HRTIM_STATE_READY)) |
mbed_official | 237:f3da66175598 | 1024 | { |
mbed_official | 237:f3da66175598 | 1025 | if((SrcAddr == 0 ) || (DestAddr == 0 ) || (Length == 0)) |
mbed_official | 237:f3da66175598 | 1026 | { |
mbed_official | 237:f3da66175598 | 1027 | return HAL_ERROR; |
mbed_official | 237:f3da66175598 | 1028 | } |
mbed_official | 237:f3da66175598 | 1029 | else |
mbed_official | 237:f3da66175598 | 1030 | { |
mbed_official | 237:f3da66175598 | 1031 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 1032 | } |
mbed_official | 237:f3da66175598 | 1033 | } |
mbed_official | 237:f3da66175598 | 1034 | |
mbed_official | 237:f3da66175598 | 1035 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 1036 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1037 | |
mbed_official | 237:f3da66175598 | 1038 | /* Get the timer DMA handler */ |
mbed_official | 237:f3da66175598 | 1039 | hdma = HRTIM_GetDMAHandleFromTimerIdx(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 1040 | |
mbed_official | 237:f3da66175598 | 1041 | /* Set the DMA transfer completed callback */ |
mbed_official | 237:f3da66175598 | 1042 | if (TimerIdx == HRTIM_TIMERINDEX_MASTER) |
mbed_official | 237:f3da66175598 | 1043 | { |
mbed_official | 237:f3da66175598 | 1044 | hdma->XferCpltCallback = HRTIM_DMAMasterCplt; |
mbed_official | 237:f3da66175598 | 1045 | } |
mbed_official | 237:f3da66175598 | 1046 | else |
mbed_official | 237:f3da66175598 | 1047 | { |
mbed_official | 237:f3da66175598 | 1048 | hdma->XferCpltCallback = HRTIM_DMATimerxCplt; |
mbed_official | 237:f3da66175598 | 1049 | } |
mbed_official | 237:f3da66175598 | 1050 | |
mbed_official | 237:f3da66175598 | 1051 | /* Set the DMA error callback */ |
mbed_official | 237:f3da66175598 | 1052 | hdma->XferErrorCallback = HRTIM_DMAError ; |
mbed_official | 237:f3da66175598 | 1053 | |
mbed_official | 237:f3da66175598 | 1054 | /* Enable the DMA channel */ |
mbed_official | 237:f3da66175598 | 1055 | HAL_DMA_Start_IT(hdma, SrcAddr, DestAddr, Length); |
mbed_official | 237:f3da66175598 | 1056 | |
mbed_official | 237:f3da66175598 | 1057 | /* Enable the timer repetition DMA request */ |
mbed_official | 237:f3da66175598 | 1058 | if (TimerIdx == HRTIM_TIMERINDEX_MASTER) |
mbed_official | 237:f3da66175598 | 1059 | { |
mbed_official | 237:f3da66175598 | 1060 | __HAL_HRTIM_MASTER_ENABLE_DMA(hhrtim, HRTIM_MASTER_DMA_MREP); |
mbed_official | 237:f3da66175598 | 1061 | } |
mbed_official | 237:f3da66175598 | 1062 | else |
mbed_official | 237:f3da66175598 | 1063 | { |
mbed_official | 237:f3da66175598 | 1064 | __HAL_HRTIM_TIMER_ENABLE_DMA(hhrtim, TimerIdx, HRTIM_TIM_DMA_REP); |
mbed_official | 237:f3da66175598 | 1065 | } |
mbed_official | 237:f3da66175598 | 1066 | |
mbed_official | 237:f3da66175598 | 1067 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 1068 | __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 1069 | |
mbed_official | 237:f3da66175598 | 1070 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 1071 | |
mbed_official | 237:f3da66175598 | 1072 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 1073 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1074 | |
mbed_official | 237:f3da66175598 | 1075 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 1076 | } |
mbed_official | 237:f3da66175598 | 1077 | |
mbed_official | 237:f3da66175598 | 1078 | /** |
mbed_official | 237:f3da66175598 | 1079 | * @brief Starts the counter of a timer operating in basic time base mode |
mbed_official | 237:f3da66175598 | 1080 | * Timer repetition DMA request is disabled. |
mbed_official | 237:f3da66175598 | 1081 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 1082 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 1083 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1084 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 1085 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 1086 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 1087 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 1088 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 1089 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 1090 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 1091 | */ |
mbed_official | 237:f3da66175598 | 1092 | HAL_StatusTypeDef HAL_HRTIM_SimpleBaseStop_DMA(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 1093 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 1094 | { |
mbed_official | 237:f3da66175598 | 1095 | DMA_HandleTypeDef * hdma; |
mbed_official | 237:f3da66175598 | 1096 | |
mbed_official | 237:f3da66175598 | 1097 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 1098 | assert_param(IS_HRTIM_TIMERINDEX(TimerIdx)); |
mbed_official | 237:f3da66175598 | 1099 | |
mbed_official | 237:f3da66175598 | 1100 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 1101 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1102 | |
mbed_official | 237:f3da66175598 | 1103 | if (TimerIdx == HRTIM_TIMERINDEX_MASTER) |
mbed_official | 237:f3da66175598 | 1104 | { |
mbed_official | 237:f3da66175598 | 1105 | /* Disable the DMA */ |
mbed_official | 237:f3da66175598 | 1106 | HAL_DMA_Abort(hhrtim->hdmaMaster); |
mbed_official | 237:f3da66175598 | 1107 | |
mbed_official | 237:f3da66175598 | 1108 | /* Disable the timer repetition DMA request */ |
mbed_official | 237:f3da66175598 | 1109 | __HAL_HRTIM_MASTER_DISABLE_DMA(hhrtim, HRTIM_MASTER_DMA_MREP); |
mbed_official | 237:f3da66175598 | 1110 | } |
mbed_official | 237:f3da66175598 | 1111 | else |
mbed_official | 237:f3da66175598 | 1112 | { |
mbed_official | 237:f3da66175598 | 1113 | /* Get the timer DMA handler */ |
mbed_official | 237:f3da66175598 | 1114 | hdma = HRTIM_GetDMAHandleFromTimerIdx(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 1115 | |
mbed_official | 237:f3da66175598 | 1116 | /* Disable the DMA */ |
mbed_official | 237:f3da66175598 | 1117 | HAL_DMA_Abort(hdma); |
mbed_official | 237:f3da66175598 | 1118 | |
mbed_official | 237:f3da66175598 | 1119 | /* Disable the timer repetition DMA request */ |
mbed_official | 237:f3da66175598 | 1120 | __HAL_HRTIM_TIMER_DISABLE_DMA(hhrtim, TimerIdx, HRTIM_TIM_DMA_REP); |
mbed_official | 237:f3da66175598 | 1121 | } |
mbed_official | 237:f3da66175598 | 1122 | |
mbed_official | 237:f3da66175598 | 1123 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 1124 | __HAL_HRTIM_DISABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 1125 | |
mbed_official | 237:f3da66175598 | 1126 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 1127 | |
mbed_official | 237:f3da66175598 | 1128 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 1129 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1130 | |
mbed_official | 237:f3da66175598 | 1131 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 1132 | } |
mbed_official | 237:f3da66175598 | 1133 | |
mbed_official | 237:f3da66175598 | 1134 | /** |
mbed_official | 237:f3da66175598 | 1135 | * @} |
mbed_official | 237:f3da66175598 | 1136 | */ |
mbed_official | 237:f3da66175598 | 1137 | |
mbed_official | 237:f3da66175598 | 1138 | /** @defgroup HAL_HRTIM_Group3 Simple output compare mode functions |
mbed_official | 237:f3da66175598 | 1139 | * @brief When a HRTIM timer operates in simple output compare mode |
mbed_official | 237:f3da66175598 | 1140 | * the output level is set to a programmable value when a match |
mbed_official | 237:f3da66175598 | 1141 | * is found between the compare register and the counter. |
mbed_official | 237:f3da66175598 | 1142 | * Compare unit 1 is automatically associated to output 1 |
mbed_official | 237:f3da66175598 | 1143 | * Compare unit 2 is automatically associated to output 2 |
mbed_official | 237:f3da66175598 | 1144 | * |
mbed_official | 237:f3da66175598 | 1145 | @verbatim |
mbed_official | 237:f3da66175598 | 1146 | =============================================================================== |
mbed_official | 237:f3da66175598 | 1147 | ##### Simple output compare functions ##### |
mbed_official | 237:f3da66175598 | 1148 | =============================================================================== |
mbed_official | 237:f3da66175598 | 1149 | [..] This section provides functions allowing to: |
mbed_official | 237:f3da66175598 | 1150 | (+) Configure simple output channel |
mbed_official | 237:f3da66175598 | 1151 | (+) Start simple output compare |
mbed_official | 237:f3da66175598 | 1152 | (+) Stop simple output compare |
mbed_official | 237:f3da66175598 | 1153 | (+) Start simple output compare and enable interrupt |
mbed_official | 237:f3da66175598 | 1154 | (+) Stop simple output compare and disable interrupt |
mbed_official | 237:f3da66175598 | 1155 | (+) Start simple output compare and enable DMA transfer |
mbed_official | 237:f3da66175598 | 1156 | (+) Stop simple output compare and disable DMA transfer |
mbed_official | 237:f3da66175598 | 1157 | |
mbed_official | 237:f3da66175598 | 1158 | @endverbatim |
mbed_official | 237:f3da66175598 | 1159 | * @{ |
mbed_official | 237:f3da66175598 | 1160 | */ |
mbed_official | 237:f3da66175598 | 1161 | |
mbed_official | 237:f3da66175598 | 1162 | /** |
mbed_official | 237:f3da66175598 | 1163 | * @brief Configures an output in basic output compare mode |
mbed_official | 237:f3da66175598 | 1164 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 1165 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 1166 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1167 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 1168 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 1169 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 1170 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 1171 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 1172 | * @param OCChannel: Timer output |
mbed_official | 237:f3da66175598 | 1173 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1174 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 1175 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 1176 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 1177 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 1178 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 1179 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 1180 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 1181 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 1182 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 1183 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 1184 | * @param pSimpleOCChannelCfg: pointer to the basic output compare output configuration structure |
mbed_official | 237:f3da66175598 | 1185 | * @note When the timer operates in basic output compare mode: |
mbed_official | 237:f3da66175598 | 1186 | * Output 1 is implicitely controled by the compare unit 1 |
mbed_official | 237:f3da66175598 | 1187 | * Output 2 is implicitely controled by the compare unit 2 |
mbed_official | 237:f3da66175598 | 1188 | * Output Set/Reset crossbar is set according to the selected output compare mode: |
mbed_official | 237:f3da66175598 | 1189 | * Toggle: SETxyR = RSTxyR = CMPy |
mbed_official | 237:f3da66175598 | 1190 | * Active: SETxyR = CMPy, RSTxyR = 0 |
mbed_official | 237:f3da66175598 | 1191 | * Inactive: SETxy =0, RSTxy = CMPy |
mbed_official | 237:f3da66175598 | 1192 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 1193 | */ |
mbed_official | 237:f3da66175598 | 1194 | HAL_StatusTypeDef HAL_HRTIM_SimpleOCChannelConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 1195 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 1196 | uint32_t OCChannel, |
mbed_official | 237:f3da66175598 | 1197 | HRTIM_SimpleOCChannelCfgTypeDef* pSimpleOCChannelCfg) |
mbed_official | 237:f3da66175598 | 1198 | { |
mbed_official | 237:f3da66175598 | 1199 | uint32_t CompareUnit = 0xFFFFFFFF; |
mbed_official | 237:f3da66175598 | 1200 | HRTIM_CompareCfgTypeDef CompareCfg; |
mbed_official | 237:f3da66175598 | 1201 | HRTIM_OutputCfgTypeDef OutputCfg; |
mbed_official | 237:f3da66175598 | 1202 | |
mbed_official | 237:f3da66175598 | 1203 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 1204 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OCChannel)); |
mbed_official | 237:f3da66175598 | 1205 | assert_param(IS_HRTIM_BASICOCMODE(pSimpleOCChannelCfg->Mode)); |
mbed_official | 237:f3da66175598 | 1206 | assert_param(IS_HRTIM_OUTPUTPOLARITY(pSimpleOCChannelCfg->Polarity)); |
mbed_official | 237:f3da66175598 | 1207 | assert_param(IS_HRTIM_OUTPUTIDLELEVEL(pSimpleOCChannelCfg->IdleLevel)); |
mbed_official | 237:f3da66175598 | 1208 | |
mbed_official | 237:f3da66175598 | 1209 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 1210 | { |
mbed_official | 237:f3da66175598 | 1211 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 1212 | } |
mbed_official | 237:f3da66175598 | 1213 | |
mbed_official | 237:f3da66175598 | 1214 | /* Set HRTIM state */ |
mbed_official | 237:f3da66175598 | 1215 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 1216 | |
mbed_official | 237:f3da66175598 | 1217 | /* Configure timer compare unit */ |
mbed_official | 237:f3da66175598 | 1218 | switch (OCChannel) |
mbed_official | 237:f3da66175598 | 1219 | { |
mbed_official | 237:f3da66175598 | 1220 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 1221 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 1222 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 1223 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 1224 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 1225 | { |
mbed_official | 237:f3da66175598 | 1226 | CompareUnit = HRTIM_COMPAREUNIT_1; |
mbed_official | 237:f3da66175598 | 1227 | } |
mbed_official | 237:f3da66175598 | 1228 | break; |
mbed_official | 237:f3da66175598 | 1229 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 1230 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 1231 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 1232 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 1233 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 1234 | { |
mbed_official | 237:f3da66175598 | 1235 | CompareUnit = HRTIM_COMPAREUNIT_2; |
mbed_official | 237:f3da66175598 | 1236 | } |
mbed_official | 237:f3da66175598 | 1237 | break; |
mbed_official | 237:f3da66175598 | 1238 | } |
mbed_official | 237:f3da66175598 | 1239 | |
mbed_official | 237:f3da66175598 | 1240 | CompareCfg.CompareValue = pSimpleOCChannelCfg->Pulse; |
mbed_official | 237:f3da66175598 | 1241 | CompareCfg.AutoDelayedMode = HRTIM_AUTODELAYEDMODE_REGULAR; |
mbed_official | 237:f3da66175598 | 1242 | CompareCfg.AutoDelayedTimeout = 0; |
mbed_official | 237:f3da66175598 | 1243 | |
mbed_official | 237:f3da66175598 | 1244 | HRTIM_CompareUnitConfig(hhrtim, |
mbed_official | 237:f3da66175598 | 1245 | TimerIdx, |
mbed_official | 237:f3da66175598 | 1246 | CompareUnit, |
mbed_official | 237:f3da66175598 | 1247 | &CompareCfg); |
mbed_official | 237:f3da66175598 | 1248 | |
mbed_official | 237:f3da66175598 | 1249 | /* Configure timer output */ |
mbed_official | 237:f3da66175598 | 1250 | OutputCfg.Polarity = pSimpleOCChannelCfg->Polarity; |
mbed_official | 237:f3da66175598 | 1251 | OutputCfg.IdleLevel = pSimpleOCChannelCfg->IdleLevel; |
mbed_official | 237:f3da66175598 | 1252 | OutputCfg.FaultLevel = HRTIM_OUTPUTFAULTLEVEL_NONE; |
mbed_official | 237:f3da66175598 | 1253 | OutputCfg.IdleMode = HRTIM_OUTPUTIDLEMODE_NONE; |
mbed_official | 237:f3da66175598 | 1254 | OutputCfg.ChopperModeEnable = HRTIM_OUTPUTCHOPPERMODE_DISABLED; |
mbed_official | 237:f3da66175598 | 1255 | OutputCfg.BurstModeEntryDelayed = HRTIM_OUTPUTBURSTMODEENTRY_REGULAR; |
mbed_official | 237:f3da66175598 | 1256 | |
mbed_official | 237:f3da66175598 | 1257 | switch (pSimpleOCChannelCfg->Mode) |
mbed_official | 237:f3da66175598 | 1258 | { |
mbed_official | 237:f3da66175598 | 1259 | case HRTIM_BASICOCMODE_TOGGLE: |
mbed_official | 237:f3da66175598 | 1260 | { |
mbed_official | 237:f3da66175598 | 1261 | if (CompareUnit == HRTIM_COMPAREUNIT_1) |
mbed_official | 237:f3da66175598 | 1262 | { |
mbed_official | 237:f3da66175598 | 1263 | OutputCfg.SetSource = HRTIM_OUTPUTSET_TIMCMP1; |
mbed_official | 237:f3da66175598 | 1264 | } |
mbed_official | 237:f3da66175598 | 1265 | else |
mbed_official | 237:f3da66175598 | 1266 | { |
mbed_official | 237:f3da66175598 | 1267 | OutputCfg.SetSource = HRTIM_OUTPUTSET_TIMCMP2; |
mbed_official | 237:f3da66175598 | 1268 | } |
mbed_official | 237:f3da66175598 | 1269 | OutputCfg.ResetSource = OutputCfg.SetSource; |
mbed_official | 237:f3da66175598 | 1270 | } |
mbed_official | 237:f3da66175598 | 1271 | break; |
mbed_official | 237:f3da66175598 | 1272 | case HRTIM_BASICOCMODE_ACTIVE: |
mbed_official | 237:f3da66175598 | 1273 | { |
mbed_official | 237:f3da66175598 | 1274 | if (CompareUnit == HRTIM_COMPAREUNIT_1) |
mbed_official | 237:f3da66175598 | 1275 | { |
mbed_official | 237:f3da66175598 | 1276 | OutputCfg.SetSource = HRTIM_OUTPUTSET_TIMCMP1; |
mbed_official | 237:f3da66175598 | 1277 | } |
mbed_official | 237:f3da66175598 | 1278 | else |
mbed_official | 237:f3da66175598 | 1279 | { |
mbed_official | 237:f3da66175598 | 1280 | OutputCfg.SetSource = HRTIM_OUTPUTSET_TIMCMP2; |
mbed_official | 237:f3da66175598 | 1281 | } |
mbed_official | 237:f3da66175598 | 1282 | OutputCfg.ResetSource = HRTIM_OUTPUTRESET_NONE; |
mbed_official | 237:f3da66175598 | 1283 | } |
mbed_official | 237:f3da66175598 | 1284 | break; |
mbed_official | 237:f3da66175598 | 1285 | case HRTIM_BASICOCMODE_INACTIVE: |
mbed_official | 237:f3da66175598 | 1286 | { |
mbed_official | 237:f3da66175598 | 1287 | if (CompareUnit == HRTIM_COMPAREUNIT_1) |
mbed_official | 237:f3da66175598 | 1288 | { |
mbed_official | 237:f3da66175598 | 1289 | OutputCfg.ResetSource = HRTIM_OUTPUTRESET_TIMCMP1; |
mbed_official | 237:f3da66175598 | 1290 | } |
mbed_official | 237:f3da66175598 | 1291 | else |
mbed_official | 237:f3da66175598 | 1292 | { |
mbed_official | 237:f3da66175598 | 1293 | OutputCfg.ResetSource = HRTIM_OUTPUTRESET_TIMCMP2; |
mbed_official | 237:f3da66175598 | 1294 | } |
mbed_official | 237:f3da66175598 | 1295 | OutputCfg.SetSource = HRTIM_OUTPUTSET_NONE; |
mbed_official | 237:f3da66175598 | 1296 | } |
mbed_official | 237:f3da66175598 | 1297 | break; |
mbed_official | 237:f3da66175598 | 1298 | } |
mbed_official | 237:f3da66175598 | 1299 | |
mbed_official | 237:f3da66175598 | 1300 | HRTIM_OutputConfig(hhrtim, |
mbed_official | 237:f3da66175598 | 1301 | TimerIdx, |
mbed_official | 237:f3da66175598 | 1302 | OCChannel, |
mbed_official | 237:f3da66175598 | 1303 | &OutputCfg); |
mbed_official | 237:f3da66175598 | 1304 | |
mbed_official | 237:f3da66175598 | 1305 | /* Set HRTIM state */ |
mbed_official | 237:f3da66175598 | 1306 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 1307 | |
mbed_official | 237:f3da66175598 | 1308 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 1309 | } |
mbed_official | 237:f3da66175598 | 1310 | |
mbed_official | 237:f3da66175598 | 1311 | /** |
mbed_official | 237:f3da66175598 | 1312 | * @brief Starts the output compare signal generation on the designed timer output |
mbed_official | 237:f3da66175598 | 1313 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 1314 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 1315 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1316 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 1317 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 1318 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 1319 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 1320 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 1321 | * @param OCChannel: Timer output |
mbed_official | 237:f3da66175598 | 1322 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1323 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 1324 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 1325 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 1326 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 1327 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 1328 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 1329 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 1330 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 1331 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 1332 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 1333 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 1334 | */ |
mbed_official | 237:f3da66175598 | 1335 | HAL_StatusTypeDef HAL_HRTIM_SimpleOCStart(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 1336 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 1337 | uint32_t OCChannel) |
mbed_official | 237:f3da66175598 | 1338 | { |
mbed_official | 237:f3da66175598 | 1339 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 1340 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OCChannel)); |
mbed_official | 237:f3da66175598 | 1341 | |
mbed_official | 237:f3da66175598 | 1342 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 1343 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1344 | |
mbed_official | 237:f3da66175598 | 1345 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 1346 | |
mbed_official | 237:f3da66175598 | 1347 | /* Enable the timer output */ |
mbed_official | 237:f3da66175598 | 1348 | hhrtim->Instance->sCommonRegs.OENR |= OCChannel; |
mbed_official | 237:f3da66175598 | 1349 | |
mbed_official | 237:f3da66175598 | 1350 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 1351 | __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 1352 | |
mbed_official | 237:f3da66175598 | 1353 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 1354 | |
mbed_official | 237:f3da66175598 | 1355 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 1356 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1357 | |
mbed_official | 237:f3da66175598 | 1358 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 1359 | } |
mbed_official | 237:f3da66175598 | 1360 | |
mbed_official | 237:f3da66175598 | 1361 | /** |
mbed_official | 237:f3da66175598 | 1362 | * @brief Stops the output compare signal generation on the designed timer output |
mbed_official | 237:f3da66175598 | 1363 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 1364 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 1365 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1366 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 1367 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 1368 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 1369 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 1370 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 1371 | * @param OCChannel: Timer output |
mbed_official | 237:f3da66175598 | 1372 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1373 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 1374 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 1375 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 1376 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 1377 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 1378 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 1379 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 1380 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 1381 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 1382 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 1383 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 1384 | */ |
mbed_official | 237:f3da66175598 | 1385 | HAL_StatusTypeDef HAL_HRTIM_SimpleOCStop(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 1386 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 1387 | uint32_t OCChannel) |
mbed_official | 237:f3da66175598 | 1388 | { |
mbed_official | 237:f3da66175598 | 1389 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 1390 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OCChannel)); |
mbed_official | 237:f3da66175598 | 1391 | |
mbed_official | 237:f3da66175598 | 1392 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 1393 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1394 | |
mbed_official | 237:f3da66175598 | 1395 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 1396 | |
mbed_official | 237:f3da66175598 | 1397 | /* Disable the timer output */ |
mbed_official | 237:f3da66175598 | 1398 | hhrtim->Instance->sCommonRegs.ODISR |= OCChannel; |
mbed_official | 237:f3da66175598 | 1399 | |
mbed_official | 237:f3da66175598 | 1400 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 1401 | __HAL_HRTIM_DISABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 1402 | |
mbed_official | 237:f3da66175598 | 1403 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 1404 | |
mbed_official | 237:f3da66175598 | 1405 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 1406 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1407 | |
mbed_official | 237:f3da66175598 | 1408 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 1409 | } |
mbed_official | 237:f3da66175598 | 1410 | |
mbed_official | 237:f3da66175598 | 1411 | /** |
mbed_official | 237:f3da66175598 | 1412 | * @brief Starts the output compare signal generation on the designed timer output |
mbed_official | 237:f3da66175598 | 1413 | * Interrupt is enabled (see note below) |
mbed_official | 237:f3da66175598 | 1414 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 1415 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 1416 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1417 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 1418 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 1419 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 1420 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 1421 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 1422 | * @param OCChannel: Timer output |
mbed_official | 237:f3da66175598 | 1423 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1424 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 1425 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 1426 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 1427 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 1428 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 1429 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 1430 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 1431 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 1432 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 1433 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 1434 | * @note Interrupt enabling depends on the chosen output compare mode |
mbed_official | 237:f3da66175598 | 1435 | * Output toggle: compare match interrupt is enabled |
mbed_official | 237:f3da66175598 | 1436 | * Output set active: output set interrupt is enabled |
mbed_official | 237:f3da66175598 | 1437 | * Output set inactive: output reset interrupt is enabled |
mbed_official | 237:f3da66175598 | 1438 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 1439 | */ |
mbed_official | 237:f3da66175598 | 1440 | HAL_StatusTypeDef HAL_HRTIM_SimpleOCStart_IT(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 1441 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 1442 | uint32_t OCChannel) |
mbed_official | 237:f3da66175598 | 1443 | { |
mbed_official | 237:f3da66175598 | 1444 | uint32_t interrupt; |
mbed_official | 237:f3da66175598 | 1445 | |
mbed_official | 237:f3da66175598 | 1446 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 1447 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OCChannel)); |
mbed_official | 237:f3da66175598 | 1448 | |
mbed_official | 237:f3da66175598 | 1449 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 1450 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1451 | |
mbed_official | 237:f3da66175598 | 1452 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 1453 | |
mbed_official | 237:f3da66175598 | 1454 | /* Get the interrupt to enable (depends on the output compare mode) */ |
mbed_official | 237:f3da66175598 | 1455 | interrupt = HRTIM_GetITFromOCMode(hhrtim, TimerIdx, OCChannel); |
mbed_official | 237:f3da66175598 | 1456 | |
mbed_official | 237:f3da66175598 | 1457 | /* Enable the timer output */ |
mbed_official | 237:f3da66175598 | 1458 | hhrtim->Instance->sCommonRegs.OENR |= OCChannel; |
mbed_official | 237:f3da66175598 | 1459 | |
mbed_official | 237:f3da66175598 | 1460 | /* Enable the timer interrupt (depends on the output compare mode) */ |
mbed_official | 237:f3da66175598 | 1461 | __HAL_HRTIM_TIMER_ENABLE_IT(hhrtim, TimerIdx, interrupt); |
mbed_official | 237:f3da66175598 | 1462 | |
mbed_official | 237:f3da66175598 | 1463 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 1464 | __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 1465 | |
mbed_official | 237:f3da66175598 | 1466 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 1467 | |
mbed_official | 237:f3da66175598 | 1468 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 1469 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1470 | |
mbed_official | 237:f3da66175598 | 1471 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 1472 | } |
mbed_official | 237:f3da66175598 | 1473 | |
mbed_official | 237:f3da66175598 | 1474 | /** |
mbed_official | 237:f3da66175598 | 1475 | * @brief Stops the output compare signal generation on the designed timer output |
mbed_official | 237:f3da66175598 | 1476 | * Interrupt is disabled |
mbed_official | 237:f3da66175598 | 1477 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 1478 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 1479 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1480 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 1481 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 1482 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 1483 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 1484 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 1485 | * @param OCChannel: Timer output |
mbed_official | 237:f3da66175598 | 1486 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1487 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 1488 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 1489 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 1490 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 1491 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 1492 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 1493 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 1494 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 1495 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 1496 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 1497 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 1498 | */ |
mbed_official | 237:f3da66175598 | 1499 | HAL_StatusTypeDef HAL_HRTIM_SimpleOCStop_IT(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 1500 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 1501 | uint32_t OCChannel) |
mbed_official | 237:f3da66175598 | 1502 | { |
mbed_official | 237:f3da66175598 | 1503 | uint32_t interrupt; |
mbed_official | 237:f3da66175598 | 1504 | |
mbed_official | 237:f3da66175598 | 1505 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 1506 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OCChannel)); |
mbed_official | 237:f3da66175598 | 1507 | |
mbed_official | 237:f3da66175598 | 1508 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 1509 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1510 | |
mbed_official | 237:f3da66175598 | 1511 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 1512 | |
mbed_official | 237:f3da66175598 | 1513 | /* Disable the timer output */ |
mbed_official | 237:f3da66175598 | 1514 | hhrtim->Instance->sCommonRegs.ODISR |= OCChannel; |
mbed_official | 237:f3da66175598 | 1515 | |
mbed_official | 237:f3da66175598 | 1516 | /* Get the interrupt to disable (depends on the output compare mode) */ |
mbed_official | 237:f3da66175598 | 1517 | interrupt = HRTIM_GetITFromOCMode(hhrtim, TimerIdx, OCChannel); |
mbed_official | 237:f3da66175598 | 1518 | |
mbed_official | 237:f3da66175598 | 1519 | /* Disable the timer interrupt */ |
mbed_official | 237:f3da66175598 | 1520 | __HAL_HRTIM_TIMER_DISABLE_IT(hhrtim, TimerIdx, interrupt); |
mbed_official | 237:f3da66175598 | 1521 | |
mbed_official | 237:f3da66175598 | 1522 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 1523 | __HAL_HRTIM_DISABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 1524 | |
mbed_official | 237:f3da66175598 | 1525 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 1526 | |
mbed_official | 237:f3da66175598 | 1527 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 1528 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1529 | |
mbed_official | 237:f3da66175598 | 1530 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 1531 | } |
mbed_official | 237:f3da66175598 | 1532 | |
mbed_official | 237:f3da66175598 | 1533 | /** |
mbed_official | 237:f3da66175598 | 1534 | * @brief Starts the output compare signal generation on the designed timer output |
mbed_official | 237:f3da66175598 | 1535 | * DMA request is enabled (see note below) |
mbed_official | 237:f3da66175598 | 1536 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 1537 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 1538 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1539 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 1540 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 1541 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 1542 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 1543 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 1544 | * @param OCChannel: Timer output |
mbed_official | 237:f3da66175598 | 1545 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1546 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 1547 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 1548 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 1549 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 1550 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 1551 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 1552 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 1553 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 1554 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 1555 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 1556 | * @param SrcAddr: DMA transfer source address |
mbed_official | 237:f3da66175598 | 1557 | * @param DestAddr: DMA transfer destination address |
mbed_official | 237:f3da66175598 | 1558 | * @param Length: The length of data items (data size) to be transferred |
mbed_official | 237:f3da66175598 | 1559 | * from source to destination |
mbed_official | 237:f3da66175598 | 1560 | * @note DMA request enabling depends on the chosen output compare mode |
mbed_official | 237:f3da66175598 | 1561 | * Output toggle: compare match DMA request is enabled |
mbed_official | 237:f3da66175598 | 1562 | * Output set active: output set DMA request is enabled |
mbed_official | 237:f3da66175598 | 1563 | * Output set inactive: output reset DMA request is enabled |
mbed_official | 237:f3da66175598 | 1564 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 1565 | */ |
mbed_official | 237:f3da66175598 | 1566 | HAL_StatusTypeDef HAL_HRTIM_SimpleOCStart_DMA(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 1567 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 1568 | uint32_t OCChannel, |
mbed_official | 237:f3da66175598 | 1569 | uint32_t SrcAddr, |
mbed_official | 237:f3da66175598 | 1570 | uint32_t DestAddr, |
mbed_official | 237:f3da66175598 | 1571 | uint32_t Length) |
mbed_official | 237:f3da66175598 | 1572 | { |
mbed_official | 237:f3da66175598 | 1573 | DMA_HandleTypeDef * hdma; |
mbed_official | 237:f3da66175598 | 1574 | uint32_t dma_request; |
mbed_official | 237:f3da66175598 | 1575 | |
mbed_official | 237:f3da66175598 | 1576 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 1577 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OCChannel)); |
mbed_official | 237:f3da66175598 | 1578 | |
mbed_official | 237:f3da66175598 | 1579 | if((hhrtim->State == HAL_HRTIM_STATE_BUSY)) |
mbed_official | 237:f3da66175598 | 1580 | { |
mbed_official | 237:f3da66175598 | 1581 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 1582 | } |
mbed_official | 237:f3da66175598 | 1583 | if((hhrtim->State == HAL_HRTIM_STATE_READY)) |
mbed_official | 237:f3da66175598 | 1584 | { |
mbed_official | 237:f3da66175598 | 1585 | if((SrcAddr == 0 ) || (DestAddr == 0 ) || (Length == 0)) |
mbed_official | 237:f3da66175598 | 1586 | { |
mbed_official | 237:f3da66175598 | 1587 | return HAL_ERROR; |
mbed_official | 237:f3da66175598 | 1588 | } |
mbed_official | 237:f3da66175598 | 1589 | else |
mbed_official | 237:f3da66175598 | 1590 | { |
mbed_official | 237:f3da66175598 | 1591 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 1592 | } |
mbed_official | 237:f3da66175598 | 1593 | } |
mbed_official | 237:f3da66175598 | 1594 | |
mbed_official | 237:f3da66175598 | 1595 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 1596 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1597 | |
mbed_official | 237:f3da66175598 | 1598 | /* Enable the timer output */ |
mbed_official | 237:f3da66175598 | 1599 | hhrtim->Instance->sCommonRegs.OENR |= OCChannel; |
mbed_official | 237:f3da66175598 | 1600 | |
mbed_official | 237:f3da66175598 | 1601 | /* Get the DMA request to enable */ |
mbed_official | 237:f3da66175598 | 1602 | dma_request = HRTIM_GetDMAFromOCMode(hhrtim, TimerIdx, OCChannel); |
mbed_official | 237:f3da66175598 | 1603 | |
mbed_official | 237:f3da66175598 | 1604 | /* Get the timer DMA handler */ |
mbed_official | 237:f3da66175598 | 1605 | hdma = HRTIM_GetDMAHandleFromTimerIdx(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 1606 | |
mbed_official | 237:f3da66175598 | 1607 | /* Set the DMA error callback */ |
mbed_official | 237:f3da66175598 | 1608 | hdma->XferErrorCallback = HRTIM_DMAError ; |
mbed_official | 237:f3da66175598 | 1609 | |
mbed_official | 237:f3da66175598 | 1610 | /* Set the DMA transfer completed callback */ |
mbed_official | 237:f3da66175598 | 1611 | hdma->XferCpltCallback = HRTIM_DMATimerxCplt; |
mbed_official | 237:f3da66175598 | 1612 | |
mbed_official | 237:f3da66175598 | 1613 | /* Enable the DMA channel */ |
mbed_official | 237:f3da66175598 | 1614 | HAL_DMA_Start_IT(hdma, SrcAddr, DestAddr, Length); |
mbed_official | 237:f3da66175598 | 1615 | |
mbed_official | 237:f3da66175598 | 1616 | /* Enable the timer DMA request */ |
mbed_official | 237:f3da66175598 | 1617 | __HAL_HRTIM_TIMER_ENABLE_DMA(hhrtim, TimerIdx, dma_request); |
mbed_official | 237:f3da66175598 | 1618 | |
mbed_official | 237:f3da66175598 | 1619 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 1620 | __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 1621 | |
mbed_official | 237:f3da66175598 | 1622 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 1623 | |
mbed_official | 237:f3da66175598 | 1624 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 1625 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1626 | |
mbed_official | 237:f3da66175598 | 1627 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 1628 | } |
mbed_official | 237:f3da66175598 | 1629 | |
mbed_official | 237:f3da66175598 | 1630 | /** |
mbed_official | 237:f3da66175598 | 1631 | * @brief Stops the output compare signal generation on the designed timer output |
mbed_official | 237:f3da66175598 | 1632 | * DMA request is disabled |
mbed_official | 237:f3da66175598 | 1633 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 1634 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 1635 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1636 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 1637 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 1638 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 1639 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 1640 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 1641 | * @param OCChannel: Timer output |
mbed_official | 237:f3da66175598 | 1642 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1643 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 1644 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 1645 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 1646 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 1647 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 1648 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 1649 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 1650 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 1651 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 1652 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 1653 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 1654 | */ |
mbed_official | 237:f3da66175598 | 1655 | HAL_StatusTypeDef HAL_HRTIM_SimpleOCStop_DMA(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 1656 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 1657 | uint32_t OCChannel) |
mbed_official | 237:f3da66175598 | 1658 | { |
mbed_official | 237:f3da66175598 | 1659 | DMA_HandleTypeDef * hdma; |
mbed_official | 237:f3da66175598 | 1660 | uint32_t dma_request; |
mbed_official | 237:f3da66175598 | 1661 | |
mbed_official | 237:f3da66175598 | 1662 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 1663 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OCChannel)); |
mbed_official | 237:f3da66175598 | 1664 | |
mbed_official | 237:f3da66175598 | 1665 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 1666 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1667 | |
mbed_official | 237:f3da66175598 | 1668 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 1669 | |
mbed_official | 237:f3da66175598 | 1670 | /* Disable the timer output */ |
mbed_official | 237:f3da66175598 | 1671 | hhrtim->Instance->sCommonRegs.ODISR |= OCChannel; |
mbed_official | 237:f3da66175598 | 1672 | |
mbed_official | 237:f3da66175598 | 1673 | /* Get the timer DMA handler */ |
mbed_official | 237:f3da66175598 | 1674 | hdma = HRTIM_GetDMAHandleFromTimerIdx(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 1675 | |
mbed_official | 237:f3da66175598 | 1676 | /* Disable the DMA */ |
mbed_official | 237:f3da66175598 | 1677 | HAL_DMA_Abort(hdma); |
mbed_official | 237:f3da66175598 | 1678 | |
mbed_official | 237:f3da66175598 | 1679 | /* Get the DMA request to disable */ |
mbed_official | 237:f3da66175598 | 1680 | dma_request = HRTIM_GetDMAFromOCMode(hhrtim, TimerIdx, OCChannel); |
mbed_official | 237:f3da66175598 | 1681 | |
mbed_official | 237:f3da66175598 | 1682 | /* Disable the timer DMA request */ |
mbed_official | 237:f3da66175598 | 1683 | __HAL_HRTIM_TIMER_DISABLE_DMA(hhrtim, TimerIdx, dma_request); |
mbed_official | 237:f3da66175598 | 1684 | |
mbed_official | 237:f3da66175598 | 1685 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 1686 | __HAL_HRTIM_DISABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 1687 | |
mbed_official | 237:f3da66175598 | 1688 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 1689 | |
mbed_official | 237:f3da66175598 | 1690 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 1691 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1692 | |
mbed_official | 237:f3da66175598 | 1693 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 1694 | } |
mbed_official | 237:f3da66175598 | 1695 | |
mbed_official | 237:f3da66175598 | 1696 | /** |
mbed_official | 237:f3da66175598 | 1697 | * @} |
mbed_official | 237:f3da66175598 | 1698 | */ |
mbed_official | 237:f3da66175598 | 1699 | |
mbed_official | 237:f3da66175598 | 1700 | /** @defgroup HAL_HRTIM_Group4 Simple PWM output mode functions |
mbed_official | 237:f3da66175598 | 1701 | * @brief When a HRTIM timer operates in simple PWM output mode |
mbed_official | 237:f3da66175598 | 1702 | * the output level is set to a programmable value when a match is |
mbed_official | 237:f3da66175598 | 1703 | * found between the compare register and the counter and reset when |
mbed_official | 237:f3da66175598 | 1704 | * the timer period is reached. Duty cycle is determined by the |
mbed_official | 237:f3da66175598 | 1705 | * comparison value. |
mbed_official | 237:f3da66175598 | 1706 | * Compare unit 1 is automatically associated to output 1 |
mbed_official | 237:f3da66175598 | 1707 | * Compare unit 2 is automatically associated to output 2 |
mbed_official | 237:f3da66175598 | 1708 | * |
mbed_official | 237:f3da66175598 | 1709 | @verbatim |
mbed_official | 237:f3da66175598 | 1710 | =============================================================================== |
mbed_official | 237:f3da66175598 | 1711 | ##### Simple PWM output functions ##### |
mbed_official | 237:f3da66175598 | 1712 | =============================================================================== |
mbed_official | 237:f3da66175598 | 1713 | [..] This section provides functions allowing to: |
mbed_official | 237:f3da66175598 | 1714 | (+) Configure simple PWM output channel |
mbed_official | 237:f3da66175598 | 1715 | (+) Start simple PWM output |
mbed_official | 237:f3da66175598 | 1716 | (+) Stop simple PWM output |
mbed_official | 237:f3da66175598 | 1717 | (+) Start simple PWM output and enable interrupt |
mbed_official | 237:f3da66175598 | 1718 | (+) Stop simple PWM output and disable interrupt |
mbed_official | 237:f3da66175598 | 1719 | (+) Start simple PWM output and enable DMA transfer |
mbed_official | 237:f3da66175598 | 1720 | (+) Stop simple PWM output and disable DMA transfer |
mbed_official | 237:f3da66175598 | 1721 | |
mbed_official | 237:f3da66175598 | 1722 | @endverbatim |
mbed_official | 237:f3da66175598 | 1723 | * @{ |
mbed_official | 237:f3da66175598 | 1724 | */ |
mbed_official | 237:f3da66175598 | 1725 | |
mbed_official | 237:f3da66175598 | 1726 | /** |
mbed_official | 237:f3da66175598 | 1727 | * @brief Configures an output in basic PWM mode |
mbed_official | 237:f3da66175598 | 1728 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 1729 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 1730 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1731 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 1732 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 1733 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 1734 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 1735 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 1736 | * @param PWMChannel: Timer output |
mbed_official | 237:f3da66175598 | 1737 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1738 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 1739 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 1740 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 1741 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 1742 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 1743 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 1744 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 1745 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 1746 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 1747 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 1748 | * @param pSimplePWMChannelCfg: pointer to the basic PWM output configuration structure |
mbed_official | 237:f3da66175598 | 1749 | * @note When the timer operates in basic PWM output mode: |
mbed_official | 237:f3da66175598 | 1750 | * Output 1 is implicitely controled by the compare unit 1 |
mbed_official | 237:f3da66175598 | 1751 | * Output 2 is implicitely controled by the compare unit 2 |
mbed_official | 237:f3da66175598 | 1752 | * Output Set/Reset crossbar is set as follows: |
mbed_official | 237:f3da66175598 | 1753 | * Ouput 1: SETx1R = CMP1, RSTx1R = PER |
mbed_official | 237:f3da66175598 | 1754 | * Output 2: SETx2R = CMP2, RST2R = PER |
mbed_official | 237:f3da66175598 | 1755 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 1756 | */ |
mbed_official | 237:f3da66175598 | 1757 | HAL_StatusTypeDef HAL_HRTIM_SimplePWMChannelConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 1758 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 1759 | uint32_t PWMChannel, |
mbed_official | 237:f3da66175598 | 1760 | HRTIM_SimplePWMChannelCfgTypeDef* pSimplePWMChannelCfg) |
mbed_official | 237:f3da66175598 | 1761 | { |
mbed_official | 237:f3da66175598 | 1762 | uint32_t CompareUnit = 0xFFFFFFFF; |
mbed_official | 237:f3da66175598 | 1763 | HRTIM_CompareCfgTypeDef CompareCfg; |
mbed_official | 237:f3da66175598 | 1764 | HRTIM_OutputCfgTypeDef OutputCfg; |
mbed_official | 237:f3da66175598 | 1765 | |
mbed_official | 237:f3da66175598 | 1766 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 1767 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, PWMChannel)); |
mbed_official | 237:f3da66175598 | 1768 | assert_param(IS_HRTIM_OUTPUTPOLARITY(pSimplePWMChannelCfg->Polarity)); |
mbed_official | 237:f3da66175598 | 1769 | assert_param(IS_HRTIM_OUTPUTIDLELEVEL(pSimplePWMChannelCfg->IdleLevel)); |
mbed_official | 237:f3da66175598 | 1770 | |
mbed_official | 237:f3da66175598 | 1771 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 1772 | { |
mbed_official | 237:f3da66175598 | 1773 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 1774 | } |
mbed_official | 237:f3da66175598 | 1775 | |
mbed_official | 237:f3da66175598 | 1776 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 1777 | __HAL_LOCK(hhrtim); hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 1778 | |
mbed_official | 237:f3da66175598 | 1779 | /* Configure timer compare unit */ |
mbed_official | 237:f3da66175598 | 1780 | switch (PWMChannel) |
mbed_official | 237:f3da66175598 | 1781 | { |
mbed_official | 237:f3da66175598 | 1782 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 1783 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 1784 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 1785 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 1786 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 1787 | { |
mbed_official | 237:f3da66175598 | 1788 | CompareUnit = HRTIM_COMPAREUNIT_1; |
mbed_official | 237:f3da66175598 | 1789 | } |
mbed_official | 237:f3da66175598 | 1790 | break; |
mbed_official | 237:f3da66175598 | 1791 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 1792 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 1793 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 1794 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 1795 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 1796 | { |
mbed_official | 237:f3da66175598 | 1797 | CompareUnit = HRTIM_COMPAREUNIT_2; |
mbed_official | 237:f3da66175598 | 1798 | } |
mbed_official | 237:f3da66175598 | 1799 | break; |
mbed_official | 237:f3da66175598 | 1800 | } |
mbed_official | 237:f3da66175598 | 1801 | |
mbed_official | 237:f3da66175598 | 1802 | CompareCfg.CompareValue = pSimplePWMChannelCfg->Pulse; |
mbed_official | 237:f3da66175598 | 1803 | CompareCfg.AutoDelayedMode = HRTIM_AUTODELAYEDMODE_REGULAR; |
mbed_official | 237:f3da66175598 | 1804 | CompareCfg.AutoDelayedTimeout = 0; |
mbed_official | 237:f3da66175598 | 1805 | |
mbed_official | 237:f3da66175598 | 1806 | HRTIM_CompareUnitConfig(hhrtim, |
mbed_official | 237:f3da66175598 | 1807 | TimerIdx, |
mbed_official | 237:f3da66175598 | 1808 | CompareUnit, |
mbed_official | 237:f3da66175598 | 1809 | &CompareCfg); |
mbed_official | 237:f3da66175598 | 1810 | |
mbed_official | 237:f3da66175598 | 1811 | /* Configure timer output */ |
mbed_official | 237:f3da66175598 | 1812 | OutputCfg.Polarity = pSimplePWMChannelCfg->Polarity; |
mbed_official | 237:f3da66175598 | 1813 | OutputCfg.IdleLevel = pSimplePWMChannelCfg->IdleLevel; |
mbed_official | 237:f3da66175598 | 1814 | OutputCfg.FaultLevel = HRTIM_OUTPUTFAULTLEVEL_NONE; |
mbed_official | 237:f3da66175598 | 1815 | OutputCfg.IdleMode = HRTIM_OUTPUTIDLEMODE_NONE; |
mbed_official | 237:f3da66175598 | 1816 | OutputCfg.ChopperModeEnable = HRTIM_OUTPUTCHOPPERMODE_DISABLED; |
mbed_official | 237:f3da66175598 | 1817 | OutputCfg.BurstModeEntryDelayed = HRTIM_OUTPUTBURSTMODEENTRY_REGULAR; |
mbed_official | 237:f3da66175598 | 1818 | |
mbed_official | 237:f3da66175598 | 1819 | if (CompareUnit == HRTIM_COMPAREUNIT_1) |
mbed_official | 237:f3da66175598 | 1820 | { |
mbed_official | 237:f3da66175598 | 1821 | OutputCfg.SetSource = HRTIM_OUTPUTSET_TIMCMP1; |
mbed_official | 237:f3da66175598 | 1822 | } |
mbed_official | 237:f3da66175598 | 1823 | else |
mbed_official | 237:f3da66175598 | 1824 | { |
mbed_official | 237:f3da66175598 | 1825 | OutputCfg.SetSource = HRTIM_OUTPUTSET_TIMCMP2; |
mbed_official | 237:f3da66175598 | 1826 | } |
mbed_official | 237:f3da66175598 | 1827 | OutputCfg.ResetSource = HRTIM_OUTPUTSET_TIMPER; |
mbed_official | 237:f3da66175598 | 1828 | |
mbed_official | 237:f3da66175598 | 1829 | HRTIM_OutputConfig(hhrtim, |
mbed_official | 237:f3da66175598 | 1830 | TimerIdx, |
mbed_official | 237:f3da66175598 | 1831 | PWMChannel, |
mbed_official | 237:f3da66175598 | 1832 | &OutputCfg); |
mbed_official | 237:f3da66175598 | 1833 | |
mbed_official | 237:f3da66175598 | 1834 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 1835 | |
mbed_official | 237:f3da66175598 | 1836 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 1837 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1838 | |
mbed_official | 237:f3da66175598 | 1839 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 1840 | } |
mbed_official | 237:f3da66175598 | 1841 | |
mbed_official | 237:f3da66175598 | 1842 | /** |
mbed_official | 237:f3da66175598 | 1843 | * @brief Starts the PWM output signal generation on the designed timer output |
mbed_official | 237:f3da66175598 | 1844 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 1845 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 1846 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1847 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 1848 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 1849 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 1850 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 1851 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 1852 | * @param PWMChannel: Timer output |
mbed_official | 237:f3da66175598 | 1853 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1854 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 1855 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 1856 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 1857 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 1858 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 1859 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 1860 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 1861 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 1862 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 1863 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 1864 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 1865 | */ |
mbed_official | 237:f3da66175598 | 1866 | HAL_StatusTypeDef HAL_HRTIM_SimplePWMStart(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 1867 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 1868 | uint32_t PWMChannel) |
mbed_official | 237:f3da66175598 | 1869 | { |
mbed_official | 237:f3da66175598 | 1870 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 1871 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, PWMChannel)); |
mbed_official | 237:f3da66175598 | 1872 | |
mbed_official | 237:f3da66175598 | 1873 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 1874 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1875 | |
mbed_official | 237:f3da66175598 | 1876 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 1877 | |
mbed_official | 237:f3da66175598 | 1878 | /* Enable the timer output */ |
mbed_official | 237:f3da66175598 | 1879 | hhrtim->Instance->sCommonRegs.OENR |= PWMChannel; |
mbed_official | 237:f3da66175598 | 1880 | |
mbed_official | 237:f3da66175598 | 1881 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 1882 | __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 1883 | |
mbed_official | 237:f3da66175598 | 1884 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 1885 | |
mbed_official | 237:f3da66175598 | 1886 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 1887 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1888 | |
mbed_official | 237:f3da66175598 | 1889 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 1890 | } |
mbed_official | 237:f3da66175598 | 1891 | |
mbed_official | 237:f3da66175598 | 1892 | /** |
mbed_official | 237:f3da66175598 | 1893 | * @brief Stops the PWM output signal generation on the designed timer output |
mbed_official | 237:f3da66175598 | 1894 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 1895 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 1896 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1897 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 1898 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 1899 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 1900 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 1901 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 1902 | * @param PWMChannel: Timer output |
mbed_official | 237:f3da66175598 | 1903 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1904 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 1905 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 1906 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 1907 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 1908 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 1909 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 1910 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 1911 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 1912 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 1913 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 1914 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 1915 | */ |
mbed_official | 237:f3da66175598 | 1916 | HAL_StatusTypeDef HAL_HRTIM_SimplePWMStop(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 1917 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 1918 | uint32_t PWMChannel) |
mbed_official | 237:f3da66175598 | 1919 | { |
mbed_official | 237:f3da66175598 | 1920 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 1921 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, PWMChannel)); |
mbed_official | 237:f3da66175598 | 1922 | |
mbed_official | 237:f3da66175598 | 1923 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 1924 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1925 | |
mbed_official | 237:f3da66175598 | 1926 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 1927 | |
mbed_official | 237:f3da66175598 | 1928 | /* Disable the timer output */ |
mbed_official | 237:f3da66175598 | 1929 | hhrtim->Instance->sCommonRegs.ODISR |= PWMChannel; |
mbed_official | 237:f3da66175598 | 1930 | |
mbed_official | 237:f3da66175598 | 1931 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 1932 | __HAL_HRTIM_DISABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 1933 | |
mbed_official | 237:f3da66175598 | 1934 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 1935 | |
mbed_official | 237:f3da66175598 | 1936 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 1937 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1938 | |
mbed_official | 237:f3da66175598 | 1939 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 1940 | } |
mbed_official | 237:f3da66175598 | 1941 | |
mbed_official | 237:f3da66175598 | 1942 | /** |
mbed_official | 237:f3da66175598 | 1943 | * @brief Starts the PWM output signal generation on the designed timer output |
mbed_official | 237:f3da66175598 | 1944 | * The compare interrupt is enabled. |
mbed_official | 237:f3da66175598 | 1945 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 1946 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 1947 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1948 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 1949 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 1950 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 1951 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 1952 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 1953 | * @param PWMChannel: Timer output |
mbed_official | 237:f3da66175598 | 1954 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 1955 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 1956 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 1957 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 1958 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 1959 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 1960 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 1961 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 1962 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 1963 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 1964 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 1965 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 1966 | */ |
mbed_official | 237:f3da66175598 | 1967 | HAL_StatusTypeDef HAL_HRTIM_SimplePWMStart_IT(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 1968 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 1969 | uint32_t PWMChannel) |
mbed_official | 237:f3da66175598 | 1970 | { |
mbed_official | 237:f3da66175598 | 1971 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 1972 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, PWMChannel)); |
mbed_official | 237:f3da66175598 | 1973 | |
mbed_official | 237:f3da66175598 | 1974 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 1975 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 1976 | |
mbed_official | 237:f3da66175598 | 1977 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 1978 | |
mbed_official | 237:f3da66175598 | 1979 | /* Enable the timer output */ |
mbed_official | 237:f3da66175598 | 1980 | hhrtim->Instance->sCommonRegs.OENR |= PWMChannel; |
mbed_official | 237:f3da66175598 | 1981 | |
mbed_official | 237:f3da66175598 | 1982 | /* Enable the timer interrupt (depends on the PWM output) */ |
mbed_official | 237:f3da66175598 | 1983 | switch (PWMChannel) |
mbed_official | 237:f3da66175598 | 1984 | { |
mbed_official | 237:f3da66175598 | 1985 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 1986 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 1987 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 1988 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 1989 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 1990 | { |
mbed_official | 237:f3da66175598 | 1991 | __HAL_HRTIM_TIMER_ENABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP1); |
mbed_official | 237:f3da66175598 | 1992 | } |
mbed_official | 237:f3da66175598 | 1993 | break; |
mbed_official | 237:f3da66175598 | 1994 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 1995 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 1996 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 1997 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 1998 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 1999 | { |
mbed_official | 237:f3da66175598 | 2000 | __HAL_HRTIM_TIMER_ENABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP2); |
mbed_official | 237:f3da66175598 | 2001 | } |
mbed_official | 237:f3da66175598 | 2002 | break; |
mbed_official | 237:f3da66175598 | 2003 | } |
mbed_official | 237:f3da66175598 | 2004 | |
mbed_official | 237:f3da66175598 | 2005 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 2006 | __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 2007 | |
mbed_official | 237:f3da66175598 | 2008 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 2009 | |
mbed_official | 237:f3da66175598 | 2010 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 2011 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2012 | |
mbed_official | 237:f3da66175598 | 2013 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 2014 | } |
mbed_official | 237:f3da66175598 | 2015 | |
mbed_official | 237:f3da66175598 | 2016 | /** |
mbed_official | 237:f3da66175598 | 2017 | * @brief Stops the PWM output signal generation on the designed timer output |
mbed_official | 237:f3da66175598 | 2018 | * The compare interrupt is disabled. |
mbed_official | 237:f3da66175598 | 2019 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 2020 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 2021 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2022 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 2023 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 2024 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 2025 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 2026 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 2027 | * @param PWMChannel: Timer output |
mbed_official | 237:f3da66175598 | 2028 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2029 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 2030 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 2031 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 2032 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 2033 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 2034 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 2035 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 2036 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 2037 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 2038 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 2039 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 2040 | */ |
mbed_official | 237:f3da66175598 | 2041 | HAL_StatusTypeDef HAL_HRTIM_SimplePWMStop_IT(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 2042 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 2043 | uint32_t PWMChannel) |
mbed_official | 237:f3da66175598 | 2044 | { |
mbed_official | 237:f3da66175598 | 2045 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 2046 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, PWMChannel)); |
mbed_official | 237:f3da66175598 | 2047 | |
mbed_official | 237:f3da66175598 | 2048 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 2049 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2050 | |
mbed_official | 237:f3da66175598 | 2051 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 2052 | |
mbed_official | 237:f3da66175598 | 2053 | /* Disable the timer output */ |
mbed_official | 237:f3da66175598 | 2054 | hhrtim->Instance->sCommonRegs.ODISR |= PWMChannel; |
mbed_official | 237:f3da66175598 | 2055 | |
mbed_official | 237:f3da66175598 | 2056 | /* Disable the timer interrupt (depends on the PWM output) */ |
mbed_official | 237:f3da66175598 | 2057 | switch (PWMChannel) |
mbed_official | 237:f3da66175598 | 2058 | { |
mbed_official | 237:f3da66175598 | 2059 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 2060 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 2061 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 2062 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 2063 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 2064 | { |
mbed_official | 237:f3da66175598 | 2065 | __HAL_HRTIM_TIMER_DISABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP1); |
mbed_official | 237:f3da66175598 | 2066 | } |
mbed_official | 237:f3da66175598 | 2067 | break; |
mbed_official | 237:f3da66175598 | 2068 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 2069 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 2070 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 2071 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 2072 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 2073 | { |
mbed_official | 237:f3da66175598 | 2074 | __HAL_HRTIM_TIMER_DISABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP2); |
mbed_official | 237:f3da66175598 | 2075 | } |
mbed_official | 237:f3da66175598 | 2076 | break; |
mbed_official | 237:f3da66175598 | 2077 | } |
mbed_official | 237:f3da66175598 | 2078 | |
mbed_official | 237:f3da66175598 | 2079 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 2080 | __HAL_HRTIM_DISABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 2081 | |
mbed_official | 237:f3da66175598 | 2082 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 2083 | |
mbed_official | 237:f3da66175598 | 2084 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 2085 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2086 | |
mbed_official | 237:f3da66175598 | 2087 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 2088 | } |
mbed_official | 237:f3da66175598 | 2089 | |
mbed_official | 237:f3da66175598 | 2090 | /** |
mbed_official | 237:f3da66175598 | 2091 | * @brief Starts the PWM output signal generation on the designed timer output |
mbed_official | 237:f3da66175598 | 2092 | * The compare DMA request is enabled. |
mbed_official | 237:f3da66175598 | 2093 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 2094 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 2095 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2096 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 2097 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 2098 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 2099 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 2100 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 2101 | * @param PWMChannel: Timer output |
mbed_official | 237:f3da66175598 | 2102 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2103 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 2104 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 2105 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 2106 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 2107 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 2108 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 2109 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 2110 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 2111 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 2112 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 2113 | * @param SrcAddr: DMA transfer source address |
mbed_official | 237:f3da66175598 | 2114 | * @param DestAddr: DMA transfer destination address |
mbed_official | 237:f3da66175598 | 2115 | * @param Length: The length of data items (data size) to be transferred |
mbed_official | 237:f3da66175598 | 2116 | * from source to destination |
mbed_official | 237:f3da66175598 | 2117 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 2118 | */ |
mbed_official | 237:f3da66175598 | 2119 | HAL_StatusTypeDef HAL_HRTIM_SimplePWMStart_DMA(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 2120 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 2121 | uint32_t PWMChannel, |
mbed_official | 237:f3da66175598 | 2122 | uint32_t SrcAddr, |
mbed_official | 237:f3da66175598 | 2123 | uint32_t DestAddr, |
mbed_official | 237:f3da66175598 | 2124 | uint32_t Length) |
mbed_official | 237:f3da66175598 | 2125 | { |
mbed_official | 237:f3da66175598 | 2126 | DMA_HandleTypeDef * hdma; |
mbed_official | 237:f3da66175598 | 2127 | |
mbed_official | 237:f3da66175598 | 2128 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 2129 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, PWMChannel)); |
mbed_official | 237:f3da66175598 | 2130 | |
mbed_official | 237:f3da66175598 | 2131 | if((hhrtim->State == HAL_HRTIM_STATE_BUSY)) |
mbed_official | 237:f3da66175598 | 2132 | { |
mbed_official | 237:f3da66175598 | 2133 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 2134 | } |
mbed_official | 237:f3da66175598 | 2135 | if((hhrtim->State == HAL_HRTIM_STATE_READY)) |
mbed_official | 237:f3da66175598 | 2136 | { |
mbed_official | 237:f3da66175598 | 2137 | if((SrcAddr == 0 ) || (DestAddr == 0 ) || (Length == 0)) |
mbed_official | 237:f3da66175598 | 2138 | { |
mbed_official | 237:f3da66175598 | 2139 | return HAL_ERROR; |
mbed_official | 237:f3da66175598 | 2140 | } |
mbed_official | 237:f3da66175598 | 2141 | else |
mbed_official | 237:f3da66175598 | 2142 | { |
mbed_official | 237:f3da66175598 | 2143 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 2144 | } |
mbed_official | 237:f3da66175598 | 2145 | } |
mbed_official | 237:f3da66175598 | 2146 | |
mbed_official | 237:f3da66175598 | 2147 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 2148 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2149 | |
mbed_official | 237:f3da66175598 | 2150 | /* Enable the timer output */ |
mbed_official | 237:f3da66175598 | 2151 | hhrtim->Instance->sCommonRegs.OENR |= PWMChannel; |
mbed_official | 237:f3da66175598 | 2152 | |
mbed_official | 237:f3da66175598 | 2153 | /* Get the timer DMA handler */ |
mbed_official | 237:f3da66175598 | 2154 | hdma = HRTIM_GetDMAHandleFromTimerIdx(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 2155 | |
mbed_official | 237:f3da66175598 | 2156 | /* Set the DMA error callback */ |
mbed_official | 237:f3da66175598 | 2157 | hdma->XferErrorCallback = HRTIM_DMAError ; |
mbed_official | 237:f3da66175598 | 2158 | |
mbed_official | 237:f3da66175598 | 2159 | /* Set the DMA transfer completed callback */ |
mbed_official | 237:f3da66175598 | 2160 | hdma->XferCpltCallback = HRTIM_DMATimerxCplt; |
mbed_official | 237:f3da66175598 | 2161 | |
mbed_official | 237:f3da66175598 | 2162 | /* Enable the DMA channel */ |
mbed_official | 237:f3da66175598 | 2163 | HAL_DMA_Start_IT(hdma, SrcAddr, DestAddr, Length); |
mbed_official | 237:f3da66175598 | 2164 | |
mbed_official | 237:f3da66175598 | 2165 | /* Enable the timer DMA request */ |
mbed_official | 237:f3da66175598 | 2166 | switch (PWMChannel) |
mbed_official | 237:f3da66175598 | 2167 | { |
mbed_official | 237:f3da66175598 | 2168 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 2169 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 2170 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 2171 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 2172 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 2173 | { |
mbed_official | 237:f3da66175598 | 2174 | __HAL_HRTIM_TIMER_ENABLE_DMA(hhrtim, TimerIdx, HRTIM_TIM_DMA_CMP1); |
mbed_official | 237:f3da66175598 | 2175 | } |
mbed_official | 237:f3da66175598 | 2176 | break; |
mbed_official | 237:f3da66175598 | 2177 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 2178 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 2179 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 2180 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 2181 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 2182 | { |
mbed_official | 237:f3da66175598 | 2183 | __HAL_HRTIM_TIMER_ENABLE_DMA(hhrtim, TimerIdx, HRTIM_TIM_DMA_CMP2); |
mbed_official | 237:f3da66175598 | 2184 | } |
mbed_official | 237:f3da66175598 | 2185 | break; |
mbed_official | 237:f3da66175598 | 2186 | } |
mbed_official | 237:f3da66175598 | 2187 | |
mbed_official | 237:f3da66175598 | 2188 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 2189 | __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 2190 | |
mbed_official | 237:f3da66175598 | 2191 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 2192 | |
mbed_official | 237:f3da66175598 | 2193 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 2194 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2195 | |
mbed_official | 237:f3da66175598 | 2196 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 2197 | } |
mbed_official | 237:f3da66175598 | 2198 | |
mbed_official | 237:f3da66175598 | 2199 | /** |
mbed_official | 237:f3da66175598 | 2200 | * @brief Stops the PWM output signal generation on the designed timer output |
mbed_official | 237:f3da66175598 | 2201 | * The compare DMA request is disabled. |
mbed_official | 237:f3da66175598 | 2202 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 2203 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 2204 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2205 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 2206 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 2207 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 2208 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 2209 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 2210 | * @param PWMChannel: Timer output |
mbed_official | 237:f3da66175598 | 2211 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2212 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 2213 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 2214 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 2215 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 2216 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 2217 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 2218 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 2219 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 2220 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 2221 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 2222 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 2223 | */ |
mbed_official | 237:f3da66175598 | 2224 | HAL_StatusTypeDef HAL_HRTIM_SimplePWMStop_DMA(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 2225 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 2226 | uint32_t PWMChannel) |
mbed_official | 237:f3da66175598 | 2227 | { |
mbed_official | 237:f3da66175598 | 2228 | DMA_HandleTypeDef * hdma; |
mbed_official | 237:f3da66175598 | 2229 | |
mbed_official | 237:f3da66175598 | 2230 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 2231 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, PWMChannel)); |
mbed_official | 237:f3da66175598 | 2232 | |
mbed_official | 237:f3da66175598 | 2233 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 2234 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2235 | |
mbed_official | 237:f3da66175598 | 2236 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 2237 | |
mbed_official | 237:f3da66175598 | 2238 | /* Disable the timer output */ |
mbed_official | 237:f3da66175598 | 2239 | hhrtim->Instance->sCommonRegs.ODISR |= PWMChannel; |
mbed_official | 237:f3da66175598 | 2240 | |
mbed_official | 237:f3da66175598 | 2241 | /* Get the timer DMA handler */ |
mbed_official | 237:f3da66175598 | 2242 | hdma = HRTIM_GetDMAHandleFromTimerIdx(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 2243 | |
mbed_official | 237:f3da66175598 | 2244 | /* Disable the DMA */ |
mbed_official | 237:f3da66175598 | 2245 | HAL_DMA_Abort(hdma); |
mbed_official | 237:f3da66175598 | 2246 | |
mbed_official | 237:f3da66175598 | 2247 | /* Disable the timer DMA request */ |
mbed_official | 237:f3da66175598 | 2248 | switch (PWMChannel) |
mbed_official | 237:f3da66175598 | 2249 | { |
mbed_official | 237:f3da66175598 | 2250 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 2251 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 2252 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 2253 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 2254 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 2255 | { |
mbed_official | 237:f3da66175598 | 2256 | __HAL_HRTIM_TIMER_DISABLE_DMA(hhrtim, TimerIdx, HRTIM_TIM_DMA_CMP1); |
mbed_official | 237:f3da66175598 | 2257 | } |
mbed_official | 237:f3da66175598 | 2258 | break; |
mbed_official | 237:f3da66175598 | 2259 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 2260 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 2261 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 2262 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 2263 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 2264 | { |
mbed_official | 237:f3da66175598 | 2265 | __HAL_HRTIM_TIMER_DISABLE_DMA(hhrtim, TimerIdx, HRTIM_TIM_DMA_CMP2); |
mbed_official | 237:f3da66175598 | 2266 | } |
mbed_official | 237:f3da66175598 | 2267 | break; |
mbed_official | 237:f3da66175598 | 2268 | } |
mbed_official | 237:f3da66175598 | 2269 | |
mbed_official | 237:f3da66175598 | 2270 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 2271 | __HAL_HRTIM_DISABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 2272 | |
mbed_official | 237:f3da66175598 | 2273 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 2274 | |
mbed_official | 237:f3da66175598 | 2275 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 2276 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2277 | |
mbed_official | 237:f3da66175598 | 2278 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 2279 | } |
mbed_official | 237:f3da66175598 | 2280 | |
mbed_official | 237:f3da66175598 | 2281 | /** |
mbed_official | 237:f3da66175598 | 2282 | * @} |
mbed_official | 237:f3da66175598 | 2283 | */ |
mbed_official | 237:f3da66175598 | 2284 | |
mbed_official | 237:f3da66175598 | 2285 | /** @defgroup HAL_HRTIM_Group5 Simple input capture functions |
mbed_official | 237:f3da66175598 | 2286 | * @brief When a HRTIM timer operates in simple input capture mode |
mbed_official | 237:f3da66175598 | 2287 | * the Capture Register (HRTIM_CPT1/2xR) is used to latch the |
mbed_official | 237:f3da66175598 | 2288 | * value of the timer counter counter after a transition detected |
mbed_official | 237:f3da66175598 | 2289 | * on a given external event input. |
mbed_official | 237:f3da66175598 | 2290 | * |
mbed_official | 237:f3da66175598 | 2291 | @verbatim |
mbed_official | 237:f3da66175598 | 2292 | =============================================================================== |
mbed_official | 237:f3da66175598 | 2293 | ##### Simple input capture functions ##### |
mbed_official | 237:f3da66175598 | 2294 | =============================================================================== |
mbed_official | 237:f3da66175598 | 2295 | [..] This section provides functions allowing to: |
mbed_official | 237:f3da66175598 | 2296 | (+) Configure simple input capture channel |
mbed_official | 237:f3da66175598 | 2297 | (+) Start simple input capture |
mbed_official | 237:f3da66175598 | 2298 | (+) Stop simple input capture |
mbed_official | 237:f3da66175598 | 2299 | (+) Start simple input capture and enable interrupt |
mbed_official | 237:f3da66175598 | 2300 | (+) Stop simple input capture and disable interrupt |
mbed_official | 237:f3da66175598 | 2301 | (+) Start simple input capture and enable DMA transfer |
mbed_official | 237:f3da66175598 | 2302 | (+) Stop simple input capture and disable DMA transfer |
mbed_official | 237:f3da66175598 | 2303 | |
mbed_official | 237:f3da66175598 | 2304 | @endverbatim |
mbed_official | 237:f3da66175598 | 2305 | * @{ |
mbed_official | 237:f3da66175598 | 2306 | */ |
mbed_official | 237:f3da66175598 | 2307 | |
mbed_official | 237:f3da66175598 | 2308 | /** |
mbed_official | 237:f3da66175598 | 2309 | * @brief Configures a basic capture |
mbed_official | 237:f3da66175598 | 2310 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 2311 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 2312 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2313 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 2314 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 2315 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 2316 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 2317 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 2318 | * @param CaptureChannel: Capture unit |
mbed_official | 237:f3da66175598 | 2319 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2320 | * @arg HRTIM_CAPTUREUNIT_1: Capture unit 1 |
mbed_official | 237:f3da66175598 | 2321 | * @arg HRTIM_CAPTUREUNIT_2: Capture unit 2 |
mbed_official | 237:f3da66175598 | 2322 | * @param pSimpleCaptureChannelCfg: pointer to the basic capture configuration structure |
mbed_official | 237:f3da66175598 | 2323 | * @note When the timer operates in basic capture mode the capture is trigerred |
mbed_official | 237:f3da66175598 | 2324 | * by the designated external event and GPIO input is implicitely used as event source. |
mbed_official | 237:f3da66175598 | 2325 | * The cature can be triggered by a rising edge, a falling edge or both |
mbed_official | 237:f3da66175598 | 2326 | * edges on event channel. |
mbed_official | 237:f3da66175598 | 2327 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 2328 | */ |
mbed_official | 237:f3da66175598 | 2329 | HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureChannelConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 2330 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 2331 | uint32_t CaptureChannel, |
mbed_official | 237:f3da66175598 | 2332 | HRTIM_SimpleCaptureChannelCfgTypeDef* pSimpleCaptureChannelCfg) |
mbed_official | 237:f3da66175598 | 2333 | { |
mbed_official | 237:f3da66175598 | 2334 | HRTIM_EventCfgTypeDef EventCfg; |
mbed_official | 237:f3da66175598 | 2335 | |
mbed_official | 237:f3da66175598 | 2336 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 2337 | assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); |
mbed_official | 237:f3da66175598 | 2338 | assert_param(IS_HRTIM_CAPTUREUNIT(CaptureChannel)); |
mbed_official | 237:f3da66175598 | 2339 | assert_param(IS_HRTIM_EVENT(pSimpleCaptureChannelCfg->Event)); |
mbed_official | 237:f3da66175598 | 2340 | assert_param(IS_HRTIM_EVENTPOLARITY(pSimpleCaptureChannelCfg->EventSensitivity, |
mbed_official | 237:f3da66175598 | 2341 | pSimpleCaptureChannelCfg->EventPolarity)); |
mbed_official | 237:f3da66175598 | 2342 | assert_param(IS_HRTIM_EVENTSENSITIVITY(pSimpleCaptureChannelCfg->EventSensitivity)); |
mbed_official | 237:f3da66175598 | 2343 | assert_param(IS_HRTIM_EVENTFILTER(pSimpleCaptureChannelCfg->Event, |
mbed_official | 237:f3da66175598 | 2344 | pSimpleCaptureChannelCfg->EventFilter)); |
mbed_official | 237:f3da66175598 | 2345 | |
mbed_official | 237:f3da66175598 | 2346 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 2347 | { |
mbed_official | 237:f3da66175598 | 2348 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 2349 | } |
mbed_official | 237:f3da66175598 | 2350 | |
mbed_official | 237:f3da66175598 | 2351 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 2352 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2353 | |
mbed_official | 237:f3da66175598 | 2354 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 2355 | |
mbed_official | 237:f3da66175598 | 2356 | /* Configure external event channel */ |
mbed_official | 237:f3da66175598 | 2357 | EventCfg.FastMode = HRTIM_EVENTFASTMODE_DISABLE; |
mbed_official | 237:f3da66175598 | 2358 | EventCfg.Filter = pSimpleCaptureChannelCfg->EventFilter; |
mbed_official | 237:f3da66175598 | 2359 | EventCfg.Polarity = pSimpleCaptureChannelCfg->EventPolarity; |
mbed_official | 237:f3da66175598 | 2360 | EventCfg.Sensitivity = pSimpleCaptureChannelCfg->EventSensitivity; |
mbed_official | 237:f3da66175598 | 2361 | EventCfg.Source = HRTIM_EVENTSRC_1; |
mbed_official | 237:f3da66175598 | 2362 | |
mbed_official | 237:f3da66175598 | 2363 | HRTIM_EventConfig(hhrtim, |
mbed_official | 237:f3da66175598 | 2364 | pSimpleCaptureChannelCfg->Event, |
mbed_official | 237:f3da66175598 | 2365 | &EventCfg); |
mbed_official | 237:f3da66175598 | 2366 | |
mbed_official | 237:f3da66175598 | 2367 | /* Memorize capture trigger (will be configured when the capture is started */ |
mbed_official | 237:f3da66175598 | 2368 | HRTIM_CaptureUnitConfig(hhrtim, |
mbed_official | 237:f3da66175598 | 2369 | TimerIdx, |
mbed_official | 237:f3da66175598 | 2370 | CaptureChannel, |
mbed_official | 237:f3da66175598 | 2371 | pSimpleCaptureChannelCfg->Event); |
mbed_official | 237:f3da66175598 | 2372 | |
mbed_official | 237:f3da66175598 | 2373 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 2374 | |
mbed_official | 237:f3da66175598 | 2375 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 2376 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2377 | |
mbed_official | 237:f3da66175598 | 2378 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 2379 | } |
mbed_official | 237:f3da66175598 | 2380 | |
mbed_official | 237:f3da66175598 | 2381 | /** |
mbed_official | 237:f3da66175598 | 2382 | * @brief Enables a basic capture on the designed capture unit |
mbed_official | 237:f3da66175598 | 2383 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 2384 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 2385 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2386 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 2387 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 2388 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 2389 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 2390 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 2391 | * @param CaptureChannel: Timer output |
mbed_official | 237:f3da66175598 | 2392 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2393 | * @arg HRTIM_CAPTUREUNIT_1: Capture unit 1 |
mbed_official | 237:f3da66175598 | 2394 | * @arg HRTIM_CAPTUREUNIT_2: Capture unit 2 |
mbed_official | 237:f3da66175598 | 2395 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 2396 | * @note The external event triggering the capture is available for all timing |
mbed_official | 237:f3da66175598 | 2397 | * units. It can be used directly and is active as soon as the timing |
mbed_official | 237:f3da66175598 | 2398 | * unit counter is enabled. |
mbed_official | 237:f3da66175598 | 2399 | */ |
mbed_official | 237:f3da66175598 | 2400 | HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStart(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 2401 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 2402 | uint32_t CaptureChannel) |
mbed_official | 237:f3da66175598 | 2403 | { |
mbed_official | 237:f3da66175598 | 2404 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 2405 | assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); |
mbed_official | 237:f3da66175598 | 2406 | assert_param(IS_HRTIM_CAPTUREUNIT(CaptureChannel)); |
mbed_official | 237:f3da66175598 | 2407 | |
mbed_official | 237:f3da66175598 | 2408 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 2409 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2410 | |
mbed_official | 237:f3da66175598 | 2411 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 2412 | |
mbed_official | 237:f3da66175598 | 2413 | /* Set the capture unit trigger */ |
mbed_official | 237:f3da66175598 | 2414 | switch (CaptureChannel) |
mbed_official | 237:f3da66175598 | 2415 | { |
mbed_official | 237:f3da66175598 | 2416 | case HRTIM_CAPTUREUNIT_1: |
mbed_official | 237:f3da66175598 | 2417 | { |
mbed_official | 237:f3da66175598 | 2418 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT1xCR = hhrtim->TimerParam[TimerIdx].CaptureTrigger1; |
mbed_official | 237:f3da66175598 | 2419 | } |
mbed_official | 237:f3da66175598 | 2420 | break; |
mbed_official | 237:f3da66175598 | 2421 | case HRTIM_CAPTUREUNIT_2: |
mbed_official | 237:f3da66175598 | 2422 | { |
mbed_official | 237:f3da66175598 | 2423 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR = hhrtim->TimerParam[TimerIdx].CaptureTrigger2; |
mbed_official | 237:f3da66175598 | 2424 | } |
mbed_official | 237:f3da66175598 | 2425 | break; |
mbed_official | 237:f3da66175598 | 2426 | } |
mbed_official | 237:f3da66175598 | 2427 | |
mbed_official | 237:f3da66175598 | 2428 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 2429 | __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 2430 | |
mbed_official | 237:f3da66175598 | 2431 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 2432 | |
mbed_official | 237:f3da66175598 | 2433 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 2434 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2435 | |
mbed_official | 237:f3da66175598 | 2436 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 2437 | } |
mbed_official | 237:f3da66175598 | 2438 | |
mbed_official | 237:f3da66175598 | 2439 | /** |
mbed_official | 237:f3da66175598 | 2440 | * @brief Disables a basic capture on the designed capture unit |
mbed_official | 237:f3da66175598 | 2441 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 2442 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 2443 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2444 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 2445 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 2446 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 2447 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 2448 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 2449 | * @param CaptureChannel: Timer output |
mbed_official | 237:f3da66175598 | 2450 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2451 | * @arg HRTIM_CAPTUREUNIT_1: Capture unit 1 |
mbed_official | 237:f3da66175598 | 2452 | * @arg HRTIM_CAPTUREUNIT_2: Capture unit 2 |
mbed_official | 237:f3da66175598 | 2453 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 2454 | */ |
mbed_official | 237:f3da66175598 | 2455 | HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStop(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 2456 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 2457 | uint32_t CaptureChannel) |
mbed_official | 237:f3da66175598 | 2458 | { |
mbed_official | 237:f3da66175598 | 2459 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 2460 | assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); |
mbed_official | 237:f3da66175598 | 2461 | assert_param(IS_HRTIM_CAPTUREUNIT(CaptureChannel)); |
mbed_official | 237:f3da66175598 | 2462 | |
mbed_official | 237:f3da66175598 | 2463 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 2464 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2465 | |
mbed_official | 237:f3da66175598 | 2466 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 2467 | |
mbed_official | 237:f3da66175598 | 2468 | /* Set the capture unit trigger */ |
mbed_official | 237:f3da66175598 | 2469 | switch (CaptureChannel) |
mbed_official | 237:f3da66175598 | 2470 | { |
mbed_official | 237:f3da66175598 | 2471 | case HRTIM_CAPTUREUNIT_1: |
mbed_official | 237:f3da66175598 | 2472 | { |
mbed_official | 237:f3da66175598 | 2473 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT1xCR = HRTIM_CAPTURETRIGGER_NONE; |
mbed_official | 237:f3da66175598 | 2474 | } |
mbed_official | 237:f3da66175598 | 2475 | break; |
mbed_official | 237:f3da66175598 | 2476 | case HRTIM_CAPTUREUNIT_2: |
mbed_official | 237:f3da66175598 | 2477 | { |
mbed_official | 237:f3da66175598 | 2478 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR = HRTIM_CAPTURETRIGGER_NONE; |
mbed_official | 237:f3da66175598 | 2479 | } |
mbed_official | 237:f3da66175598 | 2480 | break; |
mbed_official | 237:f3da66175598 | 2481 | } |
mbed_official | 237:f3da66175598 | 2482 | |
mbed_official | 237:f3da66175598 | 2483 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 2484 | if ((hhrtim->Instance->sTimerxRegs[TimerIdx].CPT1xCR == HRTIM_CAPTURETRIGGER_NONE) && |
mbed_official | 237:f3da66175598 | 2485 | (hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR == HRTIM_CAPTURETRIGGER_NONE)) |
mbed_official | 237:f3da66175598 | 2486 | { |
mbed_official | 237:f3da66175598 | 2487 | __HAL_HRTIM_DISABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 2488 | } |
mbed_official | 237:f3da66175598 | 2489 | |
mbed_official | 237:f3da66175598 | 2490 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 2491 | |
mbed_official | 237:f3da66175598 | 2492 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 2493 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2494 | |
mbed_official | 237:f3da66175598 | 2495 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 2496 | } |
mbed_official | 237:f3da66175598 | 2497 | |
mbed_official | 237:f3da66175598 | 2498 | /** |
mbed_official | 237:f3da66175598 | 2499 | * @brief Enables a basic capture on the designed capture unit |
mbed_official | 237:f3da66175598 | 2500 | * Capture interrupt is enabled |
mbed_official | 237:f3da66175598 | 2501 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 2502 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 2503 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2504 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 2505 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 2506 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 2507 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 2508 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 2509 | * @param CaptureChannel: Timer output |
mbed_official | 237:f3da66175598 | 2510 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2511 | * @arg HRTIM_CAPTUREUNIT_1: Capture unit 1 |
mbed_official | 237:f3da66175598 | 2512 | * @arg HRTIM_CAPTUREUNIT_2: Capture unit 2 |
mbed_official | 237:f3da66175598 | 2513 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 2514 | */ |
mbed_official | 237:f3da66175598 | 2515 | HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStart_IT(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 2516 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 2517 | uint32_t CaptureChannel) |
mbed_official | 237:f3da66175598 | 2518 | { |
mbed_official | 237:f3da66175598 | 2519 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 2520 | assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); |
mbed_official | 237:f3da66175598 | 2521 | assert_param(IS_HRTIM_CAPTUREUNIT(CaptureChannel)); |
mbed_official | 237:f3da66175598 | 2522 | |
mbed_official | 237:f3da66175598 | 2523 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 2524 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2525 | |
mbed_official | 237:f3da66175598 | 2526 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 2527 | |
mbed_official | 237:f3da66175598 | 2528 | /* Set the capture unit trigger */ |
mbed_official | 237:f3da66175598 | 2529 | switch (CaptureChannel) |
mbed_official | 237:f3da66175598 | 2530 | { |
mbed_official | 237:f3da66175598 | 2531 | case HRTIM_CAPTUREUNIT_1: |
mbed_official | 237:f3da66175598 | 2532 | { |
mbed_official | 237:f3da66175598 | 2533 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT1xCR = hhrtim->TimerParam[TimerIdx].CaptureTrigger1; |
mbed_official | 237:f3da66175598 | 2534 | |
mbed_official | 237:f3da66175598 | 2535 | /* Enable the capture unit 1 interrupt */ |
mbed_official | 237:f3da66175598 | 2536 | __HAL_HRTIM_TIMER_ENABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CPT1); |
mbed_official | 237:f3da66175598 | 2537 | } |
mbed_official | 237:f3da66175598 | 2538 | break; |
mbed_official | 237:f3da66175598 | 2539 | case HRTIM_CAPTUREUNIT_2: |
mbed_official | 237:f3da66175598 | 2540 | { |
mbed_official | 237:f3da66175598 | 2541 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR = hhrtim->TimerParam[TimerIdx].CaptureTrigger2; |
mbed_official | 237:f3da66175598 | 2542 | |
mbed_official | 237:f3da66175598 | 2543 | /* Enable the capture unit 2 interrupt */ |
mbed_official | 237:f3da66175598 | 2544 | __HAL_HRTIM_TIMER_ENABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CPT2); |
mbed_official | 237:f3da66175598 | 2545 | } |
mbed_official | 237:f3da66175598 | 2546 | break; |
mbed_official | 237:f3da66175598 | 2547 | } |
mbed_official | 237:f3da66175598 | 2548 | |
mbed_official | 237:f3da66175598 | 2549 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 2550 | __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 2551 | |
mbed_official | 237:f3da66175598 | 2552 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 2553 | |
mbed_official | 237:f3da66175598 | 2554 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 2555 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2556 | |
mbed_official | 237:f3da66175598 | 2557 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 2558 | } |
mbed_official | 237:f3da66175598 | 2559 | |
mbed_official | 237:f3da66175598 | 2560 | /** |
mbed_official | 237:f3da66175598 | 2561 | * @brief Disables a basic capture on the designed capture unit |
mbed_official | 237:f3da66175598 | 2562 | * Capture interrupt is disabled |
mbed_official | 237:f3da66175598 | 2563 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 2564 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 2565 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2566 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 2567 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 2568 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 2569 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 2570 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 2571 | * @param CaptureChannel: Timer output |
mbed_official | 237:f3da66175598 | 2572 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2573 | * @arg HRTIM_CAPTUREUNIT_1: Capture unit 1 |
mbed_official | 237:f3da66175598 | 2574 | * @arg HRTIM_CAPTUREUNIT_2: Capture unit 2 |
mbed_official | 237:f3da66175598 | 2575 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 2576 | */ |
mbed_official | 237:f3da66175598 | 2577 | HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStop_IT(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 2578 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 2579 | uint32_t CaptureChannel) |
mbed_official | 237:f3da66175598 | 2580 | { |
mbed_official | 237:f3da66175598 | 2581 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 2582 | assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); |
mbed_official | 237:f3da66175598 | 2583 | assert_param(IS_HRTIM_CAPTUREUNIT(CaptureChannel)); |
mbed_official | 237:f3da66175598 | 2584 | |
mbed_official | 237:f3da66175598 | 2585 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 2586 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2587 | |
mbed_official | 237:f3da66175598 | 2588 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 2589 | |
mbed_official | 237:f3da66175598 | 2590 | /* Set the capture unit trigger */ |
mbed_official | 237:f3da66175598 | 2591 | switch (CaptureChannel) |
mbed_official | 237:f3da66175598 | 2592 | { |
mbed_official | 237:f3da66175598 | 2593 | case HRTIM_CAPTUREUNIT_1: |
mbed_official | 237:f3da66175598 | 2594 | { |
mbed_official | 237:f3da66175598 | 2595 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT1xCR = HRTIM_CAPTURETRIGGER_NONE; |
mbed_official | 237:f3da66175598 | 2596 | |
mbed_official | 237:f3da66175598 | 2597 | /* Disable the capture unit 1 interrupt */ |
mbed_official | 237:f3da66175598 | 2598 | __HAL_HRTIM_TIMER_DISABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CPT1); |
mbed_official | 237:f3da66175598 | 2599 | } |
mbed_official | 237:f3da66175598 | 2600 | break; |
mbed_official | 237:f3da66175598 | 2601 | case HRTIM_CAPTUREUNIT_2: |
mbed_official | 237:f3da66175598 | 2602 | { |
mbed_official | 237:f3da66175598 | 2603 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR = HRTIM_CAPTURETRIGGER_NONE; |
mbed_official | 237:f3da66175598 | 2604 | |
mbed_official | 237:f3da66175598 | 2605 | /* Disable the capture unit 2 interrupt */ |
mbed_official | 237:f3da66175598 | 2606 | __HAL_HRTIM_TIMER_DISABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CPT2); |
mbed_official | 237:f3da66175598 | 2607 | } |
mbed_official | 237:f3da66175598 | 2608 | break; |
mbed_official | 237:f3da66175598 | 2609 | } |
mbed_official | 237:f3da66175598 | 2610 | |
mbed_official | 237:f3da66175598 | 2611 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 2612 | if ((hhrtim->Instance->sTimerxRegs[TimerIdx].CPT1xCR == HRTIM_CAPTURETRIGGER_NONE) && |
mbed_official | 237:f3da66175598 | 2613 | (hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR == HRTIM_CAPTURETRIGGER_NONE)) |
mbed_official | 237:f3da66175598 | 2614 | { |
mbed_official | 237:f3da66175598 | 2615 | __HAL_HRTIM_DISABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 2616 | } |
mbed_official | 237:f3da66175598 | 2617 | |
mbed_official | 237:f3da66175598 | 2618 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 2619 | |
mbed_official | 237:f3da66175598 | 2620 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 2621 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2622 | |
mbed_official | 237:f3da66175598 | 2623 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 2624 | } |
mbed_official | 237:f3da66175598 | 2625 | |
mbed_official | 237:f3da66175598 | 2626 | /** |
mbed_official | 237:f3da66175598 | 2627 | * @brief Enables a basic capture on the designed capture unit |
mbed_official | 237:f3da66175598 | 2628 | * Capture DMA request is enabled |
mbed_official | 237:f3da66175598 | 2629 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 2630 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 2631 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2632 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 2633 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 2634 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 2635 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 2636 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 2637 | * @param CaptureChannel: Timer output |
mbed_official | 237:f3da66175598 | 2638 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2639 | * @arg HRTIM_CAPTUREUNIT_1: Capture unit 1 |
mbed_official | 237:f3da66175598 | 2640 | * @arg HRTIM_CAPTUREUNIT_2: Capture unit 2 |
mbed_official | 237:f3da66175598 | 2641 | * @param SrcAddr: DMA transfer source address |
mbed_official | 237:f3da66175598 | 2642 | * @param DestAddr: DMA transfer destination address |
mbed_official | 237:f3da66175598 | 2643 | * @param Length: The length of data items (data size) to be transferred |
mbed_official | 237:f3da66175598 | 2644 | * from source to destination |
mbed_official | 237:f3da66175598 | 2645 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 2646 | */ |
mbed_official | 237:f3da66175598 | 2647 | HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStart_DMA(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 2648 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 2649 | uint32_t CaptureChannel, |
mbed_official | 237:f3da66175598 | 2650 | uint32_t SrcAddr, |
mbed_official | 237:f3da66175598 | 2651 | uint32_t DestAddr, |
mbed_official | 237:f3da66175598 | 2652 | uint32_t Length) |
mbed_official | 237:f3da66175598 | 2653 | { |
mbed_official | 237:f3da66175598 | 2654 | DMA_HandleTypeDef * hdma; |
mbed_official | 237:f3da66175598 | 2655 | |
mbed_official | 237:f3da66175598 | 2656 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 2657 | assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); |
mbed_official | 237:f3da66175598 | 2658 | assert_param(IS_HRTIM_CAPTUREUNIT(CaptureChannel)); |
mbed_official | 237:f3da66175598 | 2659 | |
mbed_official | 237:f3da66175598 | 2660 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 2661 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2662 | |
mbed_official | 237:f3da66175598 | 2663 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 2664 | |
mbed_official | 237:f3da66175598 | 2665 | /* Get the timer DMA handler */ |
mbed_official | 237:f3da66175598 | 2666 | hdma = HRTIM_GetDMAHandleFromTimerIdx(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 2667 | |
mbed_official | 237:f3da66175598 | 2668 | /* Set the DMA error callback */ |
mbed_official | 237:f3da66175598 | 2669 | hdma->XferErrorCallback = HRTIM_DMAError ; |
mbed_official | 237:f3da66175598 | 2670 | |
mbed_official | 237:f3da66175598 | 2671 | /* Set the DMA transfer completed callback */ |
mbed_official | 237:f3da66175598 | 2672 | hdma->XferCpltCallback = HRTIM_DMATimerxCplt; |
mbed_official | 237:f3da66175598 | 2673 | |
mbed_official | 237:f3da66175598 | 2674 | /* Enable the DMA channel */ |
mbed_official | 237:f3da66175598 | 2675 | HAL_DMA_Start_IT(hdma, SrcAddr, DestAddr, Length); |
mbed_official | 237:f3da66175598 | 2676 | |
mbed_official | 237:f3da66175598 | 2677 | switch (CaptureChannel) |
mbed_official | 237:f3da66175598 | 2678 | { |
mbed_official | 237:f3da66175598 | 2679 | case HRTIM_CAPTUREUNIT_1: |
mbed_official | 237:f3da66175598 | 2680 | { |
mbed_official | 237:f3da66175598 | 2681 | /* Set the capture unit trigger */ |
mbed_official | 237:f3da66175598 | 2682 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT1xCR = hhrtim->TimerParam[TimerIdx].CaptureTrigger1; |
mbed_official | 237:f3da66175598 | 2683 | |
mbed_official | 237:f3da66175598 | 2684 | __HAL_HRTIM_TIMER_ENABLE_DMA(hhrtim, TimerIdx, HRTIM_TIM_DMA_CPT1); |
mbed_official | 237:f3da66175598 | 2685 | } |
mbed_official | 237:f3da66175598 | 2686 | break; |
mbed_official | 237:f3da66175598 | 2687 | case HRTIM_CAPTUREUNIT_2: |
mbed_official | 237:f3da66175598 | 2688 | { |
mbed_official | 237:f3da66175598 | 2689 | /* Set the capture unit trigger */ |
mbed_official | 237:f3da66175598 | 2690 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR = hhrtim->TimerParam[TimerIdx].CaptureTrigger2; |
mbed_official | 237:f3da66175598 | 2691 | |
mbed_official | 237:f3da66175598 | 2692 | /* Enable the timer DMA request */ |
mbed_official | 237:f3da66175598 | 2693 | __HAL_HRTIM_TIMER_ENABLE_DMA(hhrtim, TimerIdx, HRTIM_TIM_DMA_CPT2); |
mbed_official | 237:f3da66175598 | 2694 | } |
mbed_official | 237:f3da66175598 | 2695 | break; |
mbed_official | 237:f3da66175598 | 2696 | } |
mbed_official | 237:f3da66175598 | 2697 | |
mbed_official | 237:f3da66175598 | 2698 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 2699 | __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 2700 | |
mbed_official | 237:f3da66175598 | 2701 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 2702 | |
mbed_official | 237:f3da66175598 | 2703 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 2704 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2705 | |
mbed_official | 237:f3da66175598 | 2706 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 2707 | } |
mbed_official | 237:f3da66175598 | 2708 | |
mbed_official | 237:f3da66175598 | 2709 | /** |
mbed_official | 237:f3da66175598 | 2710 | * @brief Disables a basic capture on the designed capture unit |
mbed_official | 237:f3da66175598 | 2711 | * Capture DMA request is disabled |
mbed_official | 237:f3da66175598 | 2712 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 2713 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 2714 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2715 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 2716 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 2717 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 2718 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 2719 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 2720 | * @param CaptureChannel: Timer output |
mbed_official | 237:f3da66175598 | 2721 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2722 | * @arg HRTIM_CAPTUREUNIT_1: Capture unit 1 |
mbed_official | 237:f3da66175598 | 2723 | * @arg HRTIM_CAPTUREUNIT_2: Capture unit 2 |
mbed_official | 237:f3da66175598 | 2724 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 2725 | */ |
mbed_official | 237:f3da66175598 | 2726 | HAL_StatusTypeDef HAL_HRTIM_SimpleCaptureStop_DMA(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 2727 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 2728 | uint32_t CaptureChannel) |
mbed_official | 237:f3da66175598 | 2729 | { |
mbed_official | 237:f3da66175598 | 2730 | DMA_HandleTypeDef * hdma; |
mbed_official | 237:f3da66175598 | 2731 | |
mbed_official | 237:f3da66175598 | 2732 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 2733 | assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); |
mbed_official | 237:f3da66175598 | 2734 | assert_param(IS_HRTIM_CAPTUREUNIT(CaptureChannel)); |
mbed_official | 237:f3da66175598 | 2735 | |
mbed_official | 237:f3da66175598 | 2736 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 2737 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2738 | |
mbed_official | 237:f3da66175598 | 2739 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 2740 | |
mbed_official | 237:f3da66175598 | 2741 | /* Get the timer DMA handler */ |
mbed_official | 237:f3da66175598 | 2742 | hdma = HRTIM_GetDMAHandleFromTimerIdx(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 2743 | |
mbed_official | 237:f3da66175598 | 2744 | /* Disable the DMA */ |
mbed_official | 237:f3da66175598 | 2745 | HAL_DMA_Abort(hdma); |
mbed_official | 237:f3da66175598 | 2746 | |
mbed_official | 237:f3da66175598 | 2747 | switch (CaptureChannel) |
mbed_official | 237:f3da66175598 | 2748 | { |
mbed_official | 237:f3da66175598 | 2749 | case HRTIM_CAPTUREUNIT_1: |
mbed_official | 237:f3da66175598 | 2750 | { |
mbed_official | 237:f3da66175598 | 2751 | /* Reset the capture unit trigger */ |
mbed_official | 237:f3da66175598 | 2752 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT1xCR = HRTIM_CAPTURETRIGGER_NONE; |
mbed_official | 237:f3da66175598 | 2753 | |
mbed_official | 237:f3da66175598 | 2754 | /* Disable the capture unit 1 DMA request */ |
mbed_official | 237:f3da66175598 | 2755 | __HAL_HRTIM_TIMER_DISABLE_DMA(hhrtim, TimerIdx, HRTIM_TIM_DMA_CPT1); |
mbed_official | 237:f3da66175598 | 2756 | } |
mbed_official | 237:f3da66175598 | 2757 | break; |
mbed_official | 237:f3da66175598 | 2758 | case HRTIM_CAPTUREUNIT_2: |
mbed_official | 237:f3da66175598 | 2759 | { |
mbed_official | 237:f3da66175598 | 2760 | /* Reset the capture unit trigger */ |
mbed_official | 237:f3da66175598 | 2761 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR = HRTIM_CAPTURETRIGGER_NONE; |
mbed_official | 237:f3da66175598 | 2762 | |
mbed_official | 237:f3da66175598 | 2763 | /* Disable the capture unit 2 DMA request */ |
mbed_official | 237:f3da66175598 | 2764 | __HAL_HRTIM_TIMER_DISABLE_DMA(hhrtim, TimerIdx, HRTIM_TIM_DMA_CPT2); |
mbed_official | 237:f3da66175598 | 2765 | } |
mbed_official | 237:f3da66175598 | 2766 | break; |
mbed_official | 237:f3da66175598 | 2767 | } |
mbed_official | 237:f3da66175598 | 2768 | |
mbed_official | 237:f3da66175598 | 2769 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 2770 | if ((hhrtim->Instance->sTimerxRegs[TimerIdx].CPT1xCR == HRTIM_CAPTURETRIGGER_NONE) && |
mbed_official | 237:f3da66175598 | 2771 | (hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR == HRTIM_CAPTURETRIGGER_NONE)) |
mbed_official | 237:f3da66175598 | 2772 | { |
mbed_official | 237:f3da66175598 | 2773 | __HAL_HRTIM_DISABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 2774 | } |
mbed_official | 237:f3da66175598 | 2775 | |
mbed_official | 237:f3da66175598 | 2776 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 2777 | |
mbed_official | 237:f3da66175598 | 2778 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 2779 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2780 | |
mbed_official | 237:f3da66175598 | 2781 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 2782 | } |
mbed_official | 237:f3da66175598 | 2783 | |
mbed_official | 237:f3da66175598 | 2784 | /** |
mbed_official | 237:f3da66175598 | 2785 | * @} |
mbed_official | 237:f3da66175598 | 2786 | */ |
mbed_official | 237:f3da66175598 | 2787 | |
mbed_official | 237:f3da66175598 | 2788 | /** @defgroup HAL_HRTIM_Group6 Simple one pulse functions |
mbed_official | 237:f3da66175598 | 2789 | * @brief When a HRTIM timer operates in simple one pulse mode |
mbed_official | 237:f3da66175598 | 2790 | * the timer counter is started in response to transition detected |
mbed_official | 237:f3da66175598 | 2791 | * on a given external event input to generate a pulse with a |
mbed_official | 237:f3da66175598 | 2792 | * programmable length after a programmable delay. |
mbed_official | 237:f3da66175598 | 2793 | * |
mbed_official | 237:f3da66175598 | 2794 | @verbatim |
mbed_official | 237:f3da66175598 | 2795 | =============================================================================== |
mbed_official | 237:f3da66175598 | 2796 | ##### Simple one pulse functions ##### |
mbed_official | 237:f3da66175598 | 2797 | =============================================================================== |
mbed_official | 237:f3da66175598 | 2798 | [..] This section provides functions allowing to: |
mbed_official | 237:f3da66175598 | 2799 | (+) Configure one pulse channel |
mbed_official | 237:f3da66175598 | 2800 | (+) Start one pulse generation |
mbed_official | 237:f3da66175598 | 2801 | (+) Stop one pulse generation |
mbed_official | 237:f3da66175598 | 2802 | (+) Start one pulse generation and enable interrupt |
mbed_official | 237:f3da66175598 | 2803 | (+) Stop one pulse generation and disable interrupt |
mbed_official | 237:f3da66175598 | 2804 | |
mbed_official | 237:f3da66175598 | 2805 | @endverbatim |
mbed_official | 237:f3da66175598 | 2806 | * @{ |
mbed_official | 237:f3da66175598 | 2807 | */ |
mbed_official | 237:f3da66175598 | 2808 | |
mbed_official | 237:f3da66175598 | 2809 | /** |
mbed_official | 237:f3da66175598 | 2810 | * @brief Configures an output basic one pulse mode |
mbed_official | 237:f3da66175598 | 2811 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 2812 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 2813 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2814 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 2815 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 2816 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 2817 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 2818 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 2819 | * @param OnePulseChannel: Timer output |
mbed_official | 237:f3da66175598 | 2820 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2821 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 2822 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 2823 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 2824 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 2825 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 2826 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 2827 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 2828 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 2829 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 2830 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 2831 | * @param pSimpleOnePulseChannelCfg: pointer to the basic one pulse output configuration structure |
mbed_official | 237:f3da66175598 | 2832 | * @note When the timer operates in basic one pulse mode: |
mbed_official | 237:f3da66175598 | 2833 | * the timer counter is implicitely started by the reset event, |
mbed_official | 237:f3da66175598 | 2834 | * the reset of the timer counter is triggered by the designated external event |
mbed_official | 237:f3da66175598 | 2835 | * GPIO input is implicitely used as event source, |
mbed_official | 237:f3da66175598 | 2836 | * Output 1 is implicitely controled by the compare unit 1, |
mbed_official | 237:f3da66175598 | 2837 | * Output 2 is implicitely controled by the compare unit 2. |
mbed_official | 237:f3da66175598 | 2838 | * Output Set/Reset crossbar is set as follows: |
mbed_official | 237:f3da66175598 | 2839 | * Ouput 1: SETx1R = CMP1, RSTx1R = PER |
mbed_official | 237:f3da66175598 | 2840 | * Output 2: SETx2R = CMP2, RST2R = PER |
mbed_official | 237:f3da66175598 | 2841 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 2842 | * @note If HAL_HRTIM_SimpleOnePulseChannelConfig is called for both timer |
mbed_official | 237:f3da66175598 | 2843 | * outputs, the reset event related configuration data provided in the |
mbed_official | 237:f3da66175598 | 2844 | * second call will override the reset event related configuration data |
mbed_official | 237:f3da66175598 | 2845 | * provided in the first call. |
mbed_official | 237:f3da66175598 | 2846 | */ |
mbed_official | 237:f3da66175598 | 2847 | HAL_StatusTypeDef HAL_HRTIM_SimpleOnePulseChannelConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 2848 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 2849 | uint32_t OnePulseChannel, |
mbed_official | 237:f3da66175598 | 2850 | HRTIM_SimpleOnePulseChannelCfgTypeDef* pSimpleOnePulseChannelCfg) |
mbed_official | 237:f3da66175598 | 2851 | { |
mbed_official | 237:f3da66175598 | 2852 | uint32_t CompareUnit = 0xFFFFFFFF; |
mbed_official | 237:f3da66175598 | 2853 | HRTIM_CompareCfgTypeDef CompareCfg; |
mbed_official | 237:f3da66175598 | 2854 | HRTIM_OutputCfgTypeDef OutputCfg; |
mbed_official | 237:f3da66175598 | 2855 | HRTIM_EventCfgTypeDef EventCfg; |
mbed_official | 237:f3da66175598 | 2856 | |
mbed_official | 237:f3da66175598 | 2857 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 2858 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OnePulseChannel)); |
mbed_official | 237:f3da66175598 | 2859 | assert_param(IS_HRTIM_OUTPUTPOLARITY(pSimpleOnePulseChannelCfg->OutputPolarity)); |
mbed_official | 237:f3da66175598 | 2860 | assert_param(IS_HRTIM_OUTPUTIDLELEVEL(pSimpleOnePulseChannelCfg->OutputIdleLevel)); |
mbed_official | 237:f3da66175598 | 2861 | assert_param(IS_HRTIM_EVENT(pSimpleOnePulseChannelCfg->Event)); |
mbed_official | 237:f3da66175598 | 2862 | assert_param(IS_HRTIM_EVENTPOLARITY(pSimpleOnePulseChannelCfg->EventSensitivity, |
mbed_official | 237:f3da66175598 | 2863 | pSimpleOnePulseChannelCfg->EventPolarity)); |
mbed_official | 237:f3da66175598 | 2864 | assert_param(IS_HRTIM_EVENTSENSITIVITY(pSimpleOnePulseChannelCfg->EventSensitivity)); |
mbed_official | 237:f3da66175598 | 2865 | assert_param(IS_HRTIM_EVENTFILTER(pSimpleOnePulseChannelCfg->Event, |
mbed_official | 237:f3da66175598 | 2866 | pSimpleOnePulseChannelCfg->EventFilter)); |
mbed_official | 237:f3da66175598 | 2867 | |
mbed_official | 237:f3da66175598 | 2868 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 2869 | { |
mbed_official | 237:f3da66175598 | 2870 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 2871 | } |
mbed_official | 237:f3da66175598 | 2872 | |
mbed_official | 237:f3da66175598 | 2873 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 2874 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2875 | |
mbed_official | 237:f3da66175598 | 2876 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 2877 | |
mbed_official | 237:f3da66175598 | 2878 | /* Configure timer compare unit */ |
mbed_official | 237:f3da66175598 | 2879 | switch (OnePulseChannel) |
mbed_official | 237:f3da66175598 | 2880 | { |
mbed_official | 237:f3da66175598 | 2881 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 2882 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 2883 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 2884 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 2885 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 2886 | { |
mbed_official | 237:f3da66175598 | 2887 | CompareUnit = HRTIM_COMPAREUNIT_1; |
mbed_official | 237:f3da66175598 | 2888 | } |
mbed_official | 237:f3da66175598 | 2889 | break; |
mbed_official | 237:f3da66175598 | 2890 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 2891 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 2892 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 2893 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 2894 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 2895 | { |
mbed_official | 237:f3da66175598 | 2896 | CompareUnit = HRTIM_COMPAREUNIT_2; |
mbed_official | 237:f3da66175598 | 2897 | } |
mbed_official | 237:f3da66175598 | 2898 | break; |
mbed_official | 237:f3da66175598 | 2899 | } |
mbed_official | 237:f3da66175598 | 2900 | |
mbed_official | 237:f3da66175598 | 2901 | CompareCfg.CompareValue = pSimpleOnePulseChannelCfg->Pulse; |
mbed_official | 237:f3da66175598 | 2902 | CompareCfg.AutoDelayedMode = HRTIM_AUTODELAYEDMODE_REGULAR; |
mbed_official | 237:f3da66175598 | 2903 | CompareCfg.AutoDelayedTimeout = 0; |
mbed_official | 237:f3da66175598 | 2904 | |
mbed_official | 237:f3da66175598 | 2905 | HRTIM_CompareUnitConfig(hhrtim, |
mbed_official | 237:f3da66175598 | 2906 | TimerIdx, |
mbed_official | 237:f3da66175598 | 2907 | CompareUnit, |
mbed_official | 237:f3da66175598 | 2908 | &CompareCfg); |
mbed_official | 237:f3da66175598 | 2909 | |
mbed_official | 237:f3da66175598 | 2910 | /* Configure timer output */ |
mbed_official | 237:f3da66175598 | 2911 | OutputCfg.Polarity = pSimpleOnePulseChannelCfg->OutputPolarity; |
mbed_official | 237:f3da66175598 | 2912 | OutputCfg.IdleLevel = pSimpleOnePulseChannelCfg->OutputIdleLevel; |
mbed_official | 237:f3da66175598 | 2913 | OutputCfg.FaultLevel = HRTIM_OUTPUTFAULTLEVEL_NONE; |
mbed_official | 237:f3da66175598 | 2914 | OutputCfg.IdleMode = HRTIM_OUTPUTIDLEMODE_NONE; |
mbed_official | 237:f3da66175598 | 2915 | OutputCfg.ChopperModeEnable = HRTIM_OUTPUTCHOPPERMODE_DISABLED; |
mbed_official | 237:f3da66175598 | 2916 | OutputCfg.BurstModeEntryDelayed = HRTIM_OUTPUTBURSTMODEENTRY_REGULAR; |
mbed_official | 237:f3da66175598 | 2917 | |
mbed_official | 237:f3da66175598 | 2918 | if (CompareUnit == HRTIM_COMPAREUNIT_1) |
mbed_official | 237:f3da66175598 | 2919 | { |
mbed_official | 237:f3da66175598 | 2920 | OutputCfg.SetSource = HRTIM_OUTPUTSET_TIMCMP1; |
mbed_official | 237:f3da66175598 | 2921 | } |
mbed_official | 237:f3da66175598 | 2922 | else |
mbed_official | 237:f3da66175598 | 2923 | { |
mbed_official | 237:f3da66175598 | 2924 | OutputCfg.SetSource = HRTIM_OUTPUTSET_TIMCMP2; |
mbed_official | 237:f3da66175598 | 2925 | } |
mbed_official | 237:f3da66175598 | 2926 | OutputCfg.ResetSource = HRTIM_OUTPUTSET_TIMPER; |
mbed_official | 237:f3da66175598 | 2927 | |
mbed_official | 237:f3da66175598 | 2928 | HRTIM_OutputConfig(hhrtim, |
mbed_official | 237:f3da66175598 | 2929 | TimerIdx, |
mbed_official | 237:f3da66175598 | 2930 | OnePulseChannel, |
mbed_official | 237:f3da66175598 | 2931 | &OutputCfg); |
mbed_official | 237:f3da66175598 | 2932 | |
mbed_official | 237:f3da66175598 | 2933 | /* Configure external event channel */ |
mbed_official | 237:f3da66175598 | 2934 | EventCfg.FastMode = HRTIM_EVENTFASTMODE_DISABLE; |
mbed_official | 237:f3da66175598 | 2935 | EventCfg.Filter = pSimpleOnePulseChannelCfg->EventFilter; |
mbed_official | 237:f3da66175598 | 2936 | EventCfg.Polarity = pSimpleOnePulseChannelCfg->EventPolarity; |
mbed_official | 237:f3da66175598 | 2937 | EventCfg.Sensitivity = pSimpleOnePulseChannelCfg->EventSensitivity; |
mbed_official | 237:f3da66175598 | 2938 | EventCfg.Source = HRTIM_EVENTSRC_1; |
mbed_official | 237:f3da66175598 | 2939 | |
mbed_official | 237:f3da66175598 | 2940 | HRTIM_EventConfig(hhrtim, |
mbed_official | 237:f3da66175598 | 2941 | pSimpleOnePulseChannelCfg->Event, |
mbed_official | 237:f3da66175598 | 2942 | &EventCfg); |
mbed_official | 237:f3da66175598 | 2943 | |
mbed_official | 237:f3da66175598 | 2944 | /* Configure the timer reset register */ |
mbed_official | 237:f3da66175598 | 2945 | HRTIM_TIM_ResetConfig(hhrtim, |
mbed_official | 237:f3da66175598 | 2946 | TimerIdx, |
mbed_official | 237:f3da66175598 | 2947 | pSimpleOnePulseChannelCfg->Event); |
mbed_official | 237:f3da66175598 | 2948 | |
mbed_official | 237:f3da66175598 | 2949 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 2950 | |
mbed_official | 237:f3da66175598 | 2951 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 2952 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2953 | |
mbed_official | 237:f3da66175598 | 2954 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 2955 | } |
mbed_official | 237:f3da66175598 | 2956 | |
mbed_official | 237:f3da66175598 | 2957 | /** |
mbed_official | 237:f3da66175598 | 2958 | * @brief Enables the basic one pulse signal generation on the designed output |
mbed_official | 237:f3da66175598 | 2959 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 2960 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 2961 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2962 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 2963 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 2964 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 2965 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 2966 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 2967 | * @param OnePulseChannel: Timer output |
mbed_official | 237:f3da66175598 | 2968 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 2969 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 2970 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 2971 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 2972 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 2973 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 2974 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 2975 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 2976 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 2977 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 2978 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 2979 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 2980 | */ |
mbed_official | 237:f3da66175598 | 2981 | HAL_StatusTypeDef HAL_HRTIM_SimpleOnePulseStart(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 2982 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 2983 | uint32_t OnePulseChannel) |
mbed_official | 237:f3da66175598 | 2984 | { |
mbed_official | 237:f3da66175598 | 2985 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 2986 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OnePulseChannel)); |
mbed_official | 237:f3da66175598 | 2987 | |
mbed_official | 237:f3da66175598 | 2988 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 2989 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 2990 | |
mbed_official | 237:f3da66175598 | 2991 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 2992 | |
mbed_official | 237:f3da66175598 | 2993 | /* Enable the timer output */ |
mbed_official | 237:f3da66175598 | 2994 | hhrtim->Instance->sCommonRegs.OENR |= OnePulseChannel; |
mbed_official | 237:f3da66175598 | 2995 | |
mbed_official | 237:f3da66175598 | 2996 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 2997 | __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 2998 | |
mbed_official | 237:f3da66175598 | 2999 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 3000 | |
mbed_official | 237:f3da66175598 | 3001 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 3002 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3003 | |
mbed_official | 237:f3da66175598 | 3004 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 3005 | } |
mbed_official | 237:f3da66175598 | 3006 | |
mbed_official | 237:f3da66175598 | 3007 | /** |
mbed_official | 237:f3da66175598 | 3008 | * @brief Disables the basic one pulse signal generation on the designed output |
mbed_official | 237:f3da66175598 | 3009 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 3010 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 3011 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3012 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 3013 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 3014 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 3015 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 3016 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 3017 | * @param OnePulseChannel: Timer output |
mbed_official | 237:f3da66175598 | 3018 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3019 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 3020 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 3021 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 3022 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 3023 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 3024 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 3025 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 3026 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 3027 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 3028 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 3029 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 3030 | */ |
mbed_official | 237:f3da66175598 | 3031 | HAL_StatusTypeDef HAL_HRTIM_SimpleOnePulseStop(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 3032 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 3033 | uint32_t OnePulseChannel) |
mbed_official | 237:f3da66175598 | 3034 | { |
mbed_official | 237:f3da66175598 | 3035 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 3036 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OnePulseChannel)); |
mbed_official | 237:f3da66175598 | 3037 | |
mbed_official | 237:f3da66175598 | 3038 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 3039 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3040 | |
mbed_official | 237:f3da66175598 | 3041 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 3042 | |
mbed_official | 237:f3da66175598 | 3043 | /* Disable the timer output */ |
mbed_official | 237:f3da66175598 | 3044 | hhrtim->Instance->sCommonRegs.ODISR |= OnePulseChannel; |
mbed_official | 237:f3da66175598 | 3045 | |
mbed_official | 237:f3da66175598 | 3046 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 3047 | __HAL_HRTIM_DISABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 3048 | |
mbed_official | 237:f3da66175598 | 3049 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 3050 | |
mbed_official | 237:f3da66175598 | 3051 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 3052 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3053 | |
mbed_official | 237:f3da66175598 | 3054 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 3055 | } |
mbed_official | 237:f3da66175598 | 3056 | |
mbed_official | 237:f3da66175598 | 3057 | /** |
mbed_official | 237:f3da66175598 | 3058 | * @brief Enables the basic one pulse signal generation on the designed output |
mbed_official | 237:f3da66175598 | 3059 | * The compare interrupt is enabled (pulse start) |
mbed_official | 237:f3da66175598 | 3060 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 3061 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 3062 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3063 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 3064 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 3065 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 3066 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 3067 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 3068 | * @param OnePulseChannel: Timer output |
mbed_official | 237:f3da66175598 | 3069 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3070 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 3071 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 3072 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 3073 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 3074 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 3075 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 3076 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 3077 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 3078 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 3079 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 3080 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 3081 | */ |
mbed_official | 237:f3da66175598 | 3082 | HAL_StatusTypeDef HAL_HRTIM_SimpleOnePulseStart_IT(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 3083 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 3084 | uint32_t OnePulseChannel) |
mbed_official | 237:f3da66175598 | 3085 | { |
mbed_official | 237:f3da66175598 | 3086 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 3087 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OnePulseChannel)); |
mbed_official | 237:f3da66175598 | 3088 | |
mbed_official | 237:f3da66175598 | 3089 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 3090 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3091 | |
mbed_official | 237:f3da66175598 | 3092 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 3093 | |
mbed_official | 237:f3da66175598 | 3094 | /* Enable the timer output */ |
mbed_official | 237:f3da66175598 | 3095 | hhrtim->Instance->sCommonRegs.OENR |= OnePulseChannel; |
mbed_official | 237:f3da66175598 | 3096 | |
mbed_official | 237:f3da66175598 | 3097 | /* Enable the timer interrupt (depends on the OnePulse output) */ |
mbed_official | 237:f3da66175598 | 3098 | switch (OnePulseChannel) |
mbed_official | 237:f3da66175598 | 3099 | { |
mbed_official | 237:f3da66175598 | 3100 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 3101 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 3102 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 3103 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 3104 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 3105 | { |
mbed_official | 237:f3da66175598 | 3106 | __HAL_HRTIM_TIMER_ENABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP1); |
mbed_official | 237:f3da66175598 | 3107 | } |
mbed_official | 237:f3da66175598 | 3108 | break; |
mbed_official | 237:f3da66175598 | 3109 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 3110 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 3111 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 3112 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 3113 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 3114 | { |
mbed_official | 237:f3da66175598 | 3115 | __HAL_HRTIM_TIMER_ENABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP2); |
mbed_official | 237:f3da66175598 | 3116 | } |
mbed_official | 237:f3da66175598 | 3117 | break; |
mbed_official | 237:f3da66175598 | 3118 | } |
mbed_official | 237:f3da66175598 | 3119 | |
mbed_official | 237:f3da66175598 | 3120 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 3121 | __HAL_HRTIM_ENABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 3122 | |
mbed_official | 237:f3da66175598 | 3123 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 3124 | |
mbed_official | 237:f3da66175598 | 3125 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 3126 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3127 | |
mbed_official | 237:f3da66175598 | 3128 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 3129 | } |
mbed_official | 237:f3da66175598 | 3130 | |
mbed_official | 237:f3da66175598 | 3131 | /** |
mbed_official | 237:f3da66175598 | 3132 | * @brief Disables the basic one pulse signal generation on the designed output |
mbed_official | 237:f3da66175598 | 3133 | * The compare interrupt is disabled |
mbed_official | 237:f3da66175598 | 3134 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 3135 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 3136 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3137 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 3138 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 3139 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 3140 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 3141 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 3142 | * @param OnePulseChannel: Timer output |
mbed_official | 237:f3da66175598 | 3143 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3144 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 3145 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 3146 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 3147 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 3148 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 3149 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 3150 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 3151 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 3152 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 3153 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 3154 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 3155 | */ |
mbed_official | 237:f3da66175598 | 3156 | HAL_StatusTypeDef HAL_HRTIM_SimpleOnePulseStop_IT(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 3157 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 3158 | uint32_t OnePulseChannel) |
mbed_official | 237:f3da66175598 | 3159 | { |
mbed_official | 237:f3da66175598 | 3160 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 3161 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OnePulseChannel)); |
mbed_official | 237:f3da66175598 | 3162 | |
mbed_official | 237:f3da66175598 | 3163 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 3164 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3165 | |
mbed_official | 237:f3da66175598 | 3166 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 3167 | |
mbed_official | 237:f3da66175598 | 3168 | /* Disable the timer output */ |
mbed_official | 237:f3da66175598 | 3169 | hhrtim->Instance->sCommonRegs.ODISR |= OnePulseChannel; |
mbed_official | 237:f3da66175598 | 3170 | |
mbed_official | 237:f3da66175598 | 3171 | /* Disable the timer interrupt (depends on the OnePulse output) */ |
mbed_official | 237:f3da66175598 | 3172 | switch (OnePulseChannel) |
mbed_official | 237:f3da66175598 | 3173 | { |
mbed_official | 237:f3da66175598 | 3174 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 3175 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 3176 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 3177 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 3178 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 3179 | { |
mbed_official | 237:f3da66175598 | 3180 | __HAL_HRTIM_TIMER_DISABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP1); |
mbed_official | 237:f3da66175598 | 3181 | } |
mbed_official | 237:f3da66175598 | 3182 | break; |
mbed_official | 237:f3da66175598 | 3183 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 3184 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 3185 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 3186 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 3187 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 3188 | { |
mbed_official | 237:f3da66175598 | 3189 | __HAL_HRTIM_TIMER_DISABLE_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP2); |
mbed_official | 237:f3da66175598 | 3190 | } |
mbed_official | 237:f3da66175598 | 3191 | break; |
mbed_official | 237:f3da66175598 | 3192 | } |
mbed_official | 237:f3da66175598 | 3193 | |
mbed_official | 237:f3da66175598 | 3194 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 3195 | __HAL_HRTIM_DISABLE(hhrtim, TimerIdxToTimerId[TimerIdx]); |
mbed_official | 237:f3da66175598 | 3196 | |
mbed_official | 237:f3da66175598 | 3197 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 3198 | |
mbed_official | 237:f3da66175598 | 3199 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 3200 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3201 | |
mbed_official | 237:f3da66175598 | 3202 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 3203 | } |
mbed_official | 237:f3da66175598 | 3204 | |
mbed_official | 237:f3da66175598 | 3205 | /** |
mbed_official | 237:f3da66175598 | 3206 | * @} |
mbed_official | 237:f3da66175598 | 3207 | */ |
mbed_official | 237:f3da66175598 | 3208 | |
mbed_official | 237:f3da66175598 | 3209 | /** @defgroup HAL_HRTIM_Group7 HRTIM configuration functions |
mbed_official | 237:f3da66175598 | 3210 | * @brief Functions configuring the HRTIM resources shared by all the |
mbed_official | 237:f3da66175598 | 3211 | * HRTIM timers operating in waveform mode. |
mbed_official | 237:f3da66175598 | 3212 | * |
mbed_official | 237:f3da66175598 | 3213 | @verbatim |
mbed_official | 237:f3da66175598 | 3214 | =============================================================================== |
mbed_official | 237:f3da66175598 | 3215 | ##### HRTIM configuration functions ##### |
mbed_official | 237:f3da66175598 | 3216 | =============================================================================== |
mbed_official | 237:f3da66175598 | 3217 | [..] This section provides functions allowing to: |
mbed_official | 237:f3da66175598 | 3218 | (+) Configure the burst mode controller |
mbed_official | 237:f3da66175598 | 3219 | (+) Configure an external event conditionning |
mbed_official | 237:f3da66175598 | 3220 | (+) Configure the external events sampling clock |
mbed_official | 237:f3da66175598 | 3221 | (+) Configure a fault conditionning |
mbed_official | 237:f3da66175598 | 3222 | (+) Enable or disable fault inputs |
mbed_official | 237:f3da66175598 | 3223 | (+) Configure the faults sampling clock |
mbed_official | 237:f3da66175598 | 3224 | (+) Configure an ADC trigger |
mbed_official | 237:f3da66175598 | 3225 | |
mbed_official | 237:f3da66175598 | 3226 | @endverbatim |
mbed_official | 237:f3da66175598 | 3227 | * @{ |
mbed_official | 237:f3da66175598 | 3228 | */ |
mbed_official | 237:f3da66175598 | 3229 | |
mbed_official | 237:f3da66175598 | 3230 | /** |
mbed_official | 237:f3da66175598 | 3231 | * @brief Configures the burst mode feature of the HRTIM |
mbed_official | 237:f3da66175598 | 3232 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 3233 | * @param pBurstModeCfg: pointer to the burst mode configuration structure |
mbed_official | 237:f3da66175598 | 3234 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 3235 | * @note This function must be called before starting the burst mode |
mbed_official | 237:f3da66175598 | 3236 | * controller |
mbed_official | 237:f3da66175598 | 3237 | */ |
mbed_official | 237:f3da66175598 | 3238 | HAL_StatusTypeDef HAL_HRTIM_BurstModeConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 3239 | HRTIM_BurstModeCfgTypeDef* pBurstModeCfg) |
mbed_official | 237:f3da66175598 | 3240 | { |
mbed_official | 237:f3da66175598 | 3241 | uint32_t hrtim_bmcr; |
mbed_official | 237:f3da66175598 | 3242 | |
mbed_official | 237:f3da66175598 | 3243 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 3244 | assert_param(IS_HRTIM_BURSTMODE(pBurstModeCfg->Mode)); |
mbed_official | 237:f3da66175598 | 3245 | assert_param(IS_HRTIM_BURSTMODECLOCKSOURCE(pBurstModeCfg->ClockSource)); |
mbed_official | 237:f3da66175598 | 3246 | assert_param(IS_HRTIM_HRTIM_BURSTMODEPRESCALER(pBurstModeCfg->Prescaler)); |
mbed_official | 237:f3da66175598 | 3247 | assert_param(IS_HRTIM_BURSTMODEPRELOAD(pBurstModeCfg->PreloadEnable)); |
mbed_official | 237:f3da66175598 | 3248 | |
mbed_official | 237:f3da66175598 | 3249 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 3250 | { |
mbed_official | 237:f3da66175598 | 3251 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 3252 | } |
mbed_official | 237:f3da66175598 | 3253 | |
mbed_official | 237:f3da66175598 | 3254 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 3255 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3256 | |
mbed_official | 237:f3da66175598 | 3257 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 3258 | |
mbed_official | 237:f3da66175598 | 3259 | hrtim_bmcr = hhrtim->Instance->sCommonRegs.BMCR; |
mbed_official | 237:f3da66175598 | 3260 | |
mbed_official | 237:f3da66175598 | 3261 | /* Set the burst mode operating mode */ |
mbed_official | 237:f3da66175598 | 3262 | hrtim_bmcr &= ~(HRTIM_BMCR_BMOM); |
mbed_official | 237:f3da66175598 | 3263 | hrtim_bmcr |= pBurstModeCfg->Mode; |
mbed_official | 237:f3da66175598 | 3264 | |
mbed_official | 237:f3da66175598 | 3265 | /* Set the burst mode clock source */ |
mbed_official | 237:f3da66175598 | 3266 | hrtim_bmcr &= ~(HRTIM_BMCR_BMCLK); |
mbed_official | 237:f3da66175598 | 3267 | hrtim_bmcr |= pBurstModeCfg->ClockSource; |
mbed_official | 237:f3da66175598 | 3268 | |
mbed_official | 237:f3da66175598 | 3269 | /* Set the burst mode prescaler */ |
mbed_official | 237:f3da66175598 | 3270 | hrtim_bmcr &= ~(HRTIM_BMCR_BMPRSC); |
mbed_official | 237:f3da66175598 | 3271 | hrtim_bmcr |= pBurstModeCfg->Prescaler; |
mbed_official | 237:f3da66175598 | 3272 | |
mbed_official | 237:f3da66175598 | 3273 | /* Enable/disable burst mode registers preload */ |
mbed_official | 237:f3da66175598 | 3274 | hrtim_bmcr &= ~(HRTIM_BMCR_BMPREN); |
mbed_official | 237:f3da66175598 | 3275 | hrtim_bmcr |= pBurstModeCfg->PreloadEnable; |
mbed_official | 237:f3da66175598 | 3276 | |
mbed_official | 237:f3da66175598 | 3277 | /* Set the burst mode trigger */ |
mbed_official | 237:f3da66175598 | 3278 | hhrtim->Instance->sCommonRegs.BMTRGR = pBurstModeCfg->Trigger; |
mbed_official | 237:f3da66175598 | 3279 | |
mbed_official | 237:f3da66175598 | 3280 | /* Set the burst mode compare value */ |
mbed_official | 237:f3da66175598 | 3281 | hhrtim->Instance->sCommonRegs.BMCMPR = pBurstModeCfg->IdleDuration; |
mbed_official | 237:f3da66175598 | 3282 | |
mbed_official | 237:f3da66175598 | 3283 | /* Set the burst mode period */ |
mbed_official | 237:f3da66175598 | 3284 | hhrtim->Instance->sCommonRegs.BMPER = pBurstModeCfg->Period; |
mbed_official | 237:f3da66175598 | 3285 | |
mbed_official | 237:f3da66175598 | 3286 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 3287 | hhrtim->Instance->sCommonRegs.BMCR = hrtim_bmcr; |
mbed_official | 237:f3da66175598 | 3288 | |
mbed_official | 237:f3da66175598 | 3289 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 3290 | |
mbed_official | 237:f3da66175598 | 3291 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 3292 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3293 | |
mbed_official | 237:f3da66175598 | 3294 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 3295 | } |
mbed_official | 237:f3da66175598 | 3296 | |
mbed_official | 237:f3da66175598 | 3297 | /** |
mbed_official | 237:f3da66175598 | 3298 | * @brief Configures the conditioning of an external event |
mbed_official | 237:f3da66175598 | 3299 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 3300 | * @param Event: external event to configure |
mbed_official | 237:f3da66175598 | 3301 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3302 | * @arg HRTIM_EVENT_1: External event 1 |
mbed_official | 237:f3da66175598 | 3303 | * @arg HRTIM_EVENT_2: External event 2 |
mbed_official | 237:f3da66175598 | 3304 | * @arg HRTIM_EVENT_3: External event 3 |
mbed_official | 237:f3da66175598 | 3305 | * @arg HRTIM_EVENT_4: External event 4 |
mbed_official | 237:f3da66175598 | 3306 | * @arg HRTIM_EVENT_5: External event 5 |
mbed_official | 237:f3da66175598 | 3307 | * @arg HRTIM_EVENT_6: External event 6 |
mbed_official | 237:f3da66175598 | 3308 | * @arg HRTIM_EVENT_7: External event 7 |
mbed_official | 237:f3da66175598 | 3309 | * @arg HRTIM_EVENT_8: External event 8 |
mbed_official | 237:f3da66175598 | 3310 | * @arg HRTIM_EVENT_9: External event 9 |
mbed_official | 237:f3da66175598 | 3311 | * @arg HRTIM_EVENT_10: External event 10 |
mbed_official | 237:f3da66175598 | 3312 | * @param pEventCfg: pointer to the event conditioning configuration structure |
mbed_official | 237:f3da66175598 | 3313 | * @note This function must be called before starting the timer |
mbed_official | 237:f3da66175598 | 3314 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 3315 | */ |
mbed_official | 237:f3da66175598 | 3316 | HAL_StatusTypeDef HAL_HRTIM_EventConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 3317 | uint32_t Event, |
mbed_official | 237:f3da66175598 | 3318 | HRTIM_EventCfgTypeDef* pEventCfg) |
mbed_official | 237:f3da66175598 | 3319 | { |
mbed_official | 237:f3da66175598 | 3320 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 3321 | assert_param(IS_HRTIM_EVENTSRC(pEventCfg->Source)); |
mbed_official | 237:f3da66175598 | 3322 | assert_param(IS_HRTIM_EVENTPOLARITY(pEventCfg->Sensitivity, pEventCfg->Polarity)); |
mbed_official | 237:f3da66175598 | 3323 | assert_param(IS_HRTIM_EVENTSENSITIVITY(pEventCfg->Sensitivity)); |
mbed_official | 237:f3da66175598 | 3324 | assert_param(IS_HRTIM_EVENTFASTMODE(Event, pEventCfg->FastMode)); |
mbed_official | 237:f3da66175598 | 3325 | assert_param(IS_HRTIM_EVENTFILTER(Event, pEventCfg->Filter)); |
mbed_official | 237:f3da66175598 | 3326 | |
mbed_official | 237:f3da66175598 | 3327 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 3328 | { |
mbed_official | 237:f3da66175598 | 3329 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 3330 | } |
mbed_official | 237:f3da66175598 | 3331 | |
mbed_official | 237:f3da66175598 | 3332 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 3333 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3334 | |
mbed_official | 237:f3da66175598 | 3335 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 3336 | |
mbed_official | 237:f3da66175598 | 3337 | /* Configure the event channel */ |
mbed_official | 237:f3da66175598 | 3338 | HRTIM_EventConfig(hhrtim, Event, pEventCfg); |
mbed_official | 237:f3da66175598 | 3339 | |
mbed_official | 237:f3da66175598 | 3340 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 3341 | |
mbed_official | 237:f3da66175598 | 3342 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 3343 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3344 | |
mbed_official | 237:f3da66175598 | 3345 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 3346 | } |
mbed_official | 237:f3da66175598 | 3347 | |
mbed_official | 237:f3da66175598 | 3348 | /** |
mbed_official | 237:f3da66175598 | 3349 | * @brief Configures the external event conditioning block prescaler |
mbed_official | 237:f3da66175598 | 3350 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 3351 | * @param Prescaler: Prescaler value |
mbed_official | 237:f3da66175598 | 3352 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3353 | * @arg HRTIM_EVENTPRESCALER_DIV1: fEEVS=fHRTIM |
mbed_official | 237:f3da66175598 | 3354 | * @arg HRTIM_EVENTPRESCALER_DIV2: fEEVS=fHRTIM / 2 |
mbed_official | 237:f3da66175598 | 3355 | * @arg HRTIM_EVENTPRESCALER_DIV4: fEEVS=fHRTIM / 4 |
mbed_official | 237:f3da66175598 | 3356 | * @arg HRTIM_EVENTPRESCALER_DIV8: fEEVS=fHRTIM / 8 |
mbed_official | 237:f3da66175598 | 3357 | * @note This function must be called before starting the timer |
mbed_official | 237:f3da66175598 | 3358 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 3359 | */ |
mbed_official | 237:f3da66175598 | 3360 | HAL_StatusTypeDef HAL_HRTIM_EventPrescalerConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 3361 | uint32_t Prescaler) |
mbed_official | 237:f3da66175598 | 3362 | { |
mbed_official | 237:f3da66175598 | 3363 | uint32_t hrtim_eecr3; |
mbed_official | 237:f3da66175598 | 3364 | |
mbed_official | 237:f3da66175598 | 3365 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 3366 | assert_param(IS_HRTIM_EVENTPRESCALER(Prescaler)); |
mbed_official | 237:f3da66175598 | 3367 | |
mbed_official | 237:f3da66175598 | 3368 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 3369 | { |
mbed_official | 237:f3da66175598 | 3370 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 3371 | } |
mbed_official | 237:f3da66175598 | 3372 | |
mbed_official | 237:f3da66175598 | 3373 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 3374 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3375 | |
mbed_official | 237:f3da66175598 | 3376 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 3377 | |
mbed_official | 237:f3da66175598 | 3378 | /* Set the external event prescaler */ |
mbed_official | 237:f3da66175598 | 3379 | hrtim_eecr3 = hhrtim->Instance->sCommonRegs.EECR3; |
mbed_official | 237:f3da66175598 | 3380 | hrtim_eecr3 &= ~(HRTIM_EECR3_EEVSD); |
mbed_official | 237:f3da66175598 | 3381 | hrtim_eecr3 |= Prescaler; |
mbed_official | 237:f3da66175598 | 3382 | |
mbed_official | 237:f3da66175598 | 3383 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 3384 | hhrtim->Instance->sCommonRegs.EECR3 = hrtim_eecr3; |
mbed_official | 237:f3da66175598 | 3385 | |
mbed_official | 237:f3da66175598 | 3386 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 3387 | |
mbed_official | 237:f3da66175598 | 3388 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 3389 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3390 | |
mbed_official | 237:f3da66175598 | 3391 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 3392 | } |
mbed_official | 237:f3da66175598 | 3393 | |
mbed_official | 237:f3da66175598 | 3394 | /** |
mbed_official | 237:f3da66175598 | 3395 | * @brief Configures the conditioning of fault input |
mbed_official | 237:f3da66175598 | 3396 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 3397 | * @param Fault: fault input to configure |
mbed_official | 237:f3da66175598 | 3398 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3399 | * @arg HRTIM_FAULT_1: Fault input 1 |
mbed_official | 237:f3da66175598 | 3400 | * @arg HRTIM_FAULT_2: Fault input 2 |
mbed_official | 237:f3da66175598 | 3401 | * @arg HRTIM_FAULT_3: Fault input 3 |
mbed_official | 237:f3da66175598 | 3402 | * @arg HRTIM_FAULT_4: Fault input 4 |
mbed_official | 237:f3da66175598 | 3403 | * @arg HRTIM_FAULT_5: Fault input 5 |
mbed_official | 237:f3da66175598 | 3404 | * @param pFaultCfg: pointer to the fault conditioning configuration structure |
mbed_official | 237:f3da66175598 | 3405 | * @note This function must be called before starting the timer and before |
mbed_official | 237:f3da66175598 | 3406 | * enabling faults inputs |
mbed_official | 237:f3da66175598 | 3407 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 3408 | */ |
mbed_official | 237:f3da66175598 | 3409 | HAL_StatusTypeDef HAL_HRTIM_FaultConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 3410 | uint32_t Fault, |
mbed_official | 237:f3da66175598 | 3411 | HRTIM_FaultCfgTypeDef* pFaultCfg) |
mbed_official | 237:f3da66175598 | 3412 | { |
mbed_official | 237:f3da66175598 | 3413 | uint32_t hrtim_fltinr1; |
mbed_official | 237:f3da66175598 | 3414 | uint32_t hrtim_fltinr2; |
mbed_official | 237:f3da66175598 | 3415 | |
mbed_official | 237:f3da66175598 | 3416 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 3417 | assert_param(IS_HRTIM_FAULT(Fault)); |
mbed_official | 237:f3da66175598 | 3418 | assert_param(IS_HRTIM_FAULTSOURCE(pFaultCfg->Source)); |
mbed_official | 237:f3da66175598 | 3419 | assert_param(IS_HRTIM_FAULTPOLARITY(pFaultCfg->Polarity)); |
mbed_official | 237:f3da66175598 | 3420 | assert_param(IS_HRTIM_FAULTFILTER(pFaultCfg->Filter)); |
mbed_official | 237:f3da66175598 | 3421 | assert_param(IS_HRTIM_FAULTLOCK(pFaultCfg->Lock)); |
mbed_official | 237:f3da66175598 | 3422 | |
mbed_official | 237:f3da66175598 | 3423 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 3424 | { |
mbed_official | 237:f3da66175598 | 3425 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 3426 | } |
mbed_official | 237:f3da66175598 | 3427 | |
mbed_official | 237:f3da66175598 | 3428 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 3429 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3430 | |
mbed_official | 237:f3da66175598 | 3431 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 3432 | |
mbed_official | 237:f3da66175598 | 3433 | /* Configure fault channel */ |
mbed_official | 237:f3da66175598 | 3434 | hrtim_fltinr1 = hhrtim->Instance->sCommonRegs.FLTINR1; |
mbed_official | 237:f3da66175598 | 3435 | hrtim_fltinr2 = hhrtim->Instance->sCommonRegs.FLTINR2; |
mbed_official | 237:f3da66175598 | 3436 | |
mbed_official | 237:f3da66175598 | 3437 | switch (Fault) |
mbed_official | 237:f3da66175598 | 3438 | { |
mbed_official | 237:f3da66175598 | 3439 | case HRTIM_FAULT_1: |
mbed_official | 237:f3da66175598 | 3440 | { |
mbed_official | 237:f3da66175598 | 3441 | hrtim_fltinr1 &= ~(HRTIM_FLTINR1_FLT1P | HRTIM_FLTINR1_FLT1SRC | HRTIM_FLTINR1_FLT1F | HRTIM_FLTINR1_FLT1LCK); |
mbed_official | 237:f3da66175598 | 3442 | hrtim_fltinr1 |= pFaultCfg->Polarity; |
mbed_official | 237:f3da66175598 | 3443 | hrtim_fltinr1 |= pFaultCfg->Source; |
mbed_official | 237:f3da66175598 | 3444 | hrtim_fltinr1 |= pFaultCfg->Filter; |
mbed_official | 237:f3da66175598 | 3445 | hrtim_fltinr1 |= pFaultCfg->Lock; |
mbed_official | 237:f3da66175598 | 3446 | } |
mbed_official | 237:f3da66175598 | 3447 | break; |
mbed_official | 237:f3da66175598 | 3448 | case HRTIM_FAULT_2: |
mbed_official | 237:f3da66175598 | 3449 | { |
mbed_official | 237:f3da66175598 | 3450 | hrtim_fltinr1 &= ~(HRTIM_FLTINR1_FLT2P | HRTIM_FLTINR1_FLT2SRC | HRTIM_FLTINR1_FLT2F | HRTIM_FLTINR1_FLT2LCK); |
mbed_official | 237:f3da66175598 | 3451 | hrtim_fltinr1 |= (pFaultCfg->Polarity << 8); |
mbed_official | 237:f3da66175598 | 3452 | hrtim_fltinr1 |= (pFaultCfg->Source << 8); |
mbed_official | 237:f3da66175598 | 3453 | hrtim_fltinr1 |= (pFaultCfg->Filter << 8); |
mbed_official | 237:f3da66175598 | 3454 | hrtim_fltinr1 |= (pFaultCfg->Lock << 8); |
mbed_official | 237:f3da66175598 | 3455 | } |
mbed_official | 237:f3da66175598 | 3456 | break; |
mbed_official | 237:f3da66175598 | 3457 | case HRTIM_FAULT_3: |
mbed_official | 237:f3da66175598 | 3458 | { |
mbed_official | 237:f3da66175598 | 3459 | hrtim_fltinr1 &= ~(HRTIM_FLTINR1_FLT3P | HRTIM_FLTINR1_FLT3SRC | HRTIM_FLTINR1_FLT3F | HRTIM_FLTINR1_FLT3LCK); |
mbed_official | 237:f3da66175598 | 3460 | hrtim_fltinr1 |= (pFaultCfg->Polarity << 16); |
mbed_official | 237:f3da66175598 | 3461 | hrtim_fltinr1 |= (pFaultCfg->Source << 16); |
mbed_official | 237:f3da66175598 | 3462 | hrtim_fltinr1 |= (pFaultCfg->Filter << 16); |
mbed_official | 237:f3da66175598 | 3463 | hrtim_fltinr1 |= (pFaultCfg->Lock << 16); |
mbed_official | 237:f3da66175598 | 3464 | } |
mbed_official | 237:f3da66175598 | 3465 | break; |
mbed_official | 237:f3da66175598 | 3466 | case HRTIM_FAULT_4: |
mbed_official | 237:f3da66175598 | 3467 | { |
mbed_official | 237:f3da66175598 | 3468 | hrtim_fltinr1 &= ~(HRTIM_FLTINR1_FLT4P | HRTIM_FLTINR1_FLT4SRC | HRTIM_FLTINR1_FLT4F | HRTIM_FLTINR1_FLT4LCK); |
mbed_official | 237:f3da66175598 | 3469 | hrtim_fltinr1 |= (pFaultCfg->Polarity << 24); |
mbed_official | 237:f3da66175598 | 3470 | hrtim_fltinr1 |= (pFaultCfg->Source << 24); |
mbed_official | 237:f3da66175598 | 3471 | hrtim_fltinr1 |= (pFaultCfg->Filter << 24); |
mbed_official | 237:f3da66175598 | 3472 | hrtim_fltinr1 |= (pFaultCfg->Lock << 24); |
mbed_official | 237:f3da66175598 | 3473 | } |
mbed_official | 237:f3da66175598 | 3474 | break; |
mbed_official | 237:f3da66175598 | 3475 | case HRTIM_FAULT_5: |
mbed_official | 237:f3da66175598 | 3476 | { |
mbed_official | 237:f3da66175598 | 3477 | hrtim_fltinr2 &= ~(HRTIM_FLTINR2_FLT5P | HRTIM_FLTINR2_FLT5SRC | HRTIM_FLTINR2_FLT5F | HRTIM_FLTINR2_FLT5LCK); |
mbed_official | 237:f3da66175598 | 3478 | hrtim_fltinr2 |= pFaultCfg->Polarity; |
mbed_official | 237:f3da66175598 | 3479 | hrtim_fltinr2 |= pFaultCfg->Source; |
mbed_official | 237:f3da66175598 | 3480 | hrtim_fltinr2 |= pFaultCfg->Filter; |
mbed_official | 237:f3da66175598 | 3481 | hrtim_fltinr2 |= pFaultCfg->Lock; |
mbed_official | 237:f3da66175598 | 3482 | } |
mbed_official | 237:f3da66175598 | 3483 | break; |
mbed_official | 237:f3da66175598 | 3484 | default: |
mbed_official | 237:f3da66175598 | 3485 | break; |
mbed_official | 237:f3da66175598 | 3486 | } |
mbed_official | 237:f3da66175598 | 3487 | |
mbed_official | 237:f3da66175598 | 3488 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 3489 | hhrtim->Instance->sCommonRegs.FLTINR1 = hrtim_fltinr1; |
mbed_official | 237:f3da66175598 | 3490 | hhrtim->Instance->sCommonRegs.FLTINR2 = hrtim_fltinr2; |
mbed_official | 237:f3da66175598 | 3491 | |
mbed_official | 237:f3da66175598 | 3492 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 3493 | |
mbed_official | 237:f3da66175598 | 3494 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 3495 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3496 | |
mbed_official | 237:f3da66175598 | 3497 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 3498 | } |
mbed_official | 237:f3da66175598 | 3499 | |
mbed_official | 237:f3da66175598 | 3500 | /** |
mbed_official | 237:f3da66175598 | 3501 | * @brief Configures the fault conditioning block prescaler |
mbed_official | 237:f3da66175598 | 3502 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 3503 | * @param Prescaler: Prescaler value |
mbed_official | 237:f3da66175598 | 3504 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3505 | * @arg HRTIM_FAULTPRESCALER_DIV1: fFLTS=fHRTIM |
mbed_official | 237:f3da66175598 | 3506 | * @arg HRTIM_FAULTPRESCALER_DIV2: fFLTS=fHRTIM / 2 |
mbed_official | 237:f3da66175598 | 3507 | * @arg HRTIM_FAULTPRESCALER_DIV4: fFLTS=fHRTIM / 4 |
mbed_official | 237:f3da66175598 | 3508 | * @arg HRTIM_FAULTPRESCALER_DIV8: fFLTS=fHRTIM / 8 |
mbed_official | 237:f3da66175598 | 3509 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 3510 | * @note This function must be called before starting the timer and before |
mbed_official | 237:f3da66175598 | 3511 | * enabling faults inputs |
mbed_official | 237:f3da66175598 | 3512 | */ |
mbed_official | 237:f3da66175598 | 3513 | HAL_StatusTypeDef HAL_HRTIM_FaultPrescalerConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 3514 | uint32_t Prescaler) |
mbed_official | 237:f3da66175598 | 3515 | { |
mbed_official | 237:f3da66175598 | 3516 | uint32_t hrtim_fltinr2; |
mbed_official | 237:f3da66175598 | 3517 | |
mbed_official | 237:f3da66175598 | 3518 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 3519 | assert_param(IS_HRTIM_FAULTPRESCALER(Prescaler)); |
mbed_official | 237:f3da66175598 | 3520 | |
mbed_official | 237:f3da66175598 | 3521 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 3522 | { |
mbed_official | 237:f3da66175598 | 3523 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 3524 | } |
mbed_official | 237:f3da66175598 | 3525 | |
mbed_official | 237:f3da66175598 | 3526 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 3527 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3528 | |
mbed_official | 237:f3da66175598 | 3529 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 3530 | |
mbed_official | 237:f3da66175598 | 3531 | /* Set the external event prescaler */ |
mbed_official | 237:f3da66175598 | 3532 | hrtim_fltinr2 = hhrtim->Instance->sCommonRegs.FLTINR2; |
mbed_official | 237:f3da66175598 | 3533 | hrtim_fltinr2 &= ~(HRTIM_FLTINR2_FLTSD); |
mbed_official | 237:f3da66175598 | 3534 | hrtim_fltinr2 |= Prescaler; |
mbed_official | 237:f3da66175598 | 3535 | |
mbed_official | 237:f3da66175598 | 3536 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 3537 | hhrtim->Instance->sCommonRegs.FLTINR2 = hrtim_fltinr2; |
mbed_official | 237:f3da66175598 | 3538 | |
mbed_official | 237:f3da66175598 | 3539 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 3540 | |
mbed_official | 237:f3da66175598 | 3541 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 3542 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3543 | |
mbed_official | 237:f3da66175598 | 3544 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 3545 | } |
mbed_official | 237:f3da66175598 | 3546 | |
mbed_official | 237:f3da66175598 | 3547 | /** |
mbed_official | 237:f3da66175598 | 3548 | * @brief Enables or disables the HRTIMx Fault mode. |
mbed_official | 237:f3da66175598 | 3549 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 3550 | * @param Faults: fault input(s) to enable or disable |
mbed_official | 237:f3da66175598 | 3551 | * This parameter can be any combination of the following values: |
mbed_official | 237:f3da66175598 | 3552 | * @arg HRTIM_FAULT_1: Fault input 1 |
mbed_official | 237:f3da66175598 | 3553 | * @arg HRTIM_FAULT_2: Fault input 2 |
mbed_official | 237:f3da66175598 | 3554 | * @arg HRTIM_FAULT_3: Fault input 3 |
mbed_official | 237:f3da66175598 | 3555 | * @arg HRTIM_FAULT_4: Fault input 4 |
mbed_official | 237:f3da66175598 | 3556 | * @arg HRTIM_FAULT_5: Fault input 5 |
mbed_official | 237:f3da66175598 | 3557 | * @param Enable: Fault(s) enabling |
mbed_official | 237:f3da66175598 | 3558 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3559 | * @arg HRTIM_FAULTMODECTL_ENABLED: Fault(s) enabled |
mbed_official | 237:f3da66175598 | 3560 | * @arg HRTIM_FAULTMODECTL_DISABLED: Fault(s) disabled |
mbed_official | 237:f3da66175598 | 3561 | * @retval None |
mbed_official | 237:f3da66175598 | 3562 | */ |
mbed_official | 237:f3da66175598 | 3563 | void HAL_HRTIM_FaultModeCtl(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 3564 | uint32_t Faults, |
mbed_official | 237:f3da66175598 | 3565 | uint32_t Enable) |
mbed_official | 237:f3da66175598 | 3566 | { |
mbed_official | 237:f3da66175598 | 3567 | uint32_t hrtim_fltinr1; |
mbed_official | 237:f3da66175598 | 3568 | uint32_t hrtim_fltinr2; |
mbed_official | 237:f3da66175598 | 3569 | |
mbed_official | 237:f3da66175598 | 3570 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 3571 | assert_param(IS_HRTIM_FAULT(Faults)); |
mbed_official | 237:f3da66175598 | 3572 | assert_param(IS_HRTIM_FAULTMODECTL(Enable)); |
mbed_official | 237:f3da66175598 | 3573 | |
mbed_official | 237:f3da66175598 | 3574 | /* Configure fault channel */ |
mbed_official | 237:f3da66175598 | 3575 | hrtim_fltinr1 = hhrtim->Instance->sCommonRegs.FLTINR1; |
mbed_official | 237:f3da66175598 | 3576 | hrtim_fltinr2 = hhrtim->Instance->sCommonRegs.FLTINR2; |
mbed_official | 237:f3da66175598 | 3577 | |
mbed_official | 237:f3da66175598 | 3578 | if ((Faults & HRTIM_FAULT_1) != RESET) |
mbed_official | 237:f3da66175598 | 3579 | { |
mbed_official | 237:f3da66175598 | 3580 | hrtim_fltinr1 &= ~HRTIM_FLTINR1_FLT1E; |
mbed_official | 237:f3da66175598 | 3581 | hrtim_fltinr1 |= Enable; |
mbed_official | 237:f3da66175598 | 3582 | } |
mbed_official | 237:f3da66175598 | 3583 | if ((Faults & HRTIM_FAULT_2) != RESET) |
mbed_official | 237:f3da66175598 | 3584 | { |
mbed_official | 237:f3da66175598 | 3585 | hrtim_fltinr1 &= ~HRTIM_FLTINR1_FLT2E; |
mbed_official | 237:f3da66175598 | 3586 | hrtim_fltinr1 |= (Enable << 8); |
mbed_official | 237:f3da66175598 | 3587 | } |
mbed_official | 237:f3da66175598 | 3588 | if ((Faults & HRTIM_FAULT_3) != RESET) |
mbed_official | 237:f3da66175598 | 3589 | { |
mbed_official | 237:f3da66175598 | 3590 | hrtim_fltinr1 &= ~HRTIM_FLTINR1_FLT3E; |
mbed_official | 237:f3da66175598 | 3591 | hrtim_fltinr1 |= (Enable << 16); |
mbed_official | 237:f3da66175598 | 3592 | } |
mbed_official | 237:f3da66175598 | 3593 | if ((Faults & HRTIM_FAULT_4) != RESET) |
mbed_official | 237:f3da66175598 | 3594 | { |
mbed_official | 237:f3da66175598 | 3595 | hrtim_fltinr1 &= ~HRTIM_FLTINR1_FLT4E; |
mbed_official | 237:f3da66175598 | 3596 | hrtim_fltinr1 |= (Enable << 24); |
mbed_official | 237:f3da66175598 | 3597 | } |
mbed_official | 237:f3da66175598 | 3598 | if ((Faults & HRTIM_FAULT_5) != RESET) |
mbed_official | 237:f3da66175598 | 3599 | { |
mbed_official | 237:f3da66175598 | 3600 | hrtim_fltinr2 &= ~HRTIM_FLTINR2_FLT5E; |
mbed_official | 237:f3da66175598 | 3601 | hrtim_fltinr2 |= Enable; |
mbed_official | 237:f3da66175598 | 3602 | } |
mbed_official | 237:f3da66175598 | 3603 | |
mbed_official | 237:f3da66175598 | 3604 | /* Update the HRTIMx registers */ |
mbed_official | 237:f3da66175598 | 3605 | hhrtim->Instance->sCommonRegs.FLTINR1 = hrtim_fltinr1; |
mbed_official | 237:f3da66175598 | 3606 | hhrtim->Instance->sCommonRegs.FLTINR2 = hrtim_fltinr2; |
mbed_official | 237:f3da66175598 | 3607 | } |
mbed_official | 237:f3da66175598 | 3608 | |
mbed_official | 237:f3da66175598 | 3609 | /** |
mbed_official | 237:f3da66175598 | 3610 | * @brief Configures both the ADC trigger register update source and the ADC |
mbed_official | 237:f3da66175598 | 3611 | * trigger source. |
mbed_official | 237:f3da66175598 | 3612 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 3613 | * @param ADCTrigger: ADC trigger to configure |
mbed_official | 237:f3da66175598 | 3614 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3615 | * @arg HRTIM_ADCTRIGGER_1: ADC trigger 1 |
mbed_official | 237:f3da66175598 | 3616 | * @arg HRTIM_ADCTRIGGER_2: ADC trigger 2 |
mbed_official | 237:f3da66175598 | 3617 | * @arg HRTIM_ADCTRIGGER_3: ADC trigger 3 |
mbed_official | 237:f3da66175598 | 3618 | * @arg HRTIM_ADCTRIGGER_4: ADC trigger 4 |
mbed_official | 237:f3da66175598 | 3619 | * @param pADCTriggerCfg: pointer to the ADC trigger configuration structure |
mbed_official | 237:f3da66175598 | 3620 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 3621 | * @note This function must be called before starting the timer |
mbed_official | 237:f3da66175598 | 3622 | */ |
mbed_official | 237:f3da66175598 | 3623 | HAL_StatusTypeDef HAL_HRTIM_ADCTriggerConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 3624 | uint32_t ADCTrigger, |
mbed_official | 237:f3da66175598 | 3625 | HRTIM_ADCTriggerCfgTypeDef* pADCTriggerCfg) |
mbed_official | 237:f3da66175598 | 3626 | { |
mbed_official | 237:f3da66175598 | 3627 | uint32_t hrtim_cr1; |
mbed_official | 237:f3da66175598 | 3628 | |
mbed_official | 237:f3da66175598 | 3629 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 3630 | assert_param(IS_HRTIM_ADCTRIGGER(ADCTrigger)); |
mbed_official | 237:f3da66175598 | 3631 | assert_param(IS_HRTIM_ADCTRIGGERUPDATE(pADCTriggerCfg->UpdateSource)); |
mbed_official | 237:f3da66175598 | 3632 | |
mbed_official | 237:f3da66175598 | 3633 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 3634 | { |
mbed_official | 237:f3da66175598 | 3635 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 3636 | } |
mbed_official | 237:f3da66175598 | 3637 | |
mbed_official | 237:f3da66175598 | 3638 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 3639 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3640 | |
mbed_official | 237:f3da66175598 | 3641 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 3642 | |
mbed_official | 237:f3da66175598 | 3643 | /* Set the ADC trigger update source */ |
mbed_official | 237:f3da66175598 | 3644 | hrtim_cr1 = hhrtim->Instance->sCommonRegs.CR1; |
mbed_official | 237:f3da66175598 | 3645 | |
mbed_official | 237:f3da66175598 | 3646 | switch (ADCTrigger) |
mbed_official | 237:f3da66175598 | 3647 | { |
mbed_official | 237:f3da66175598 | 3648 | case HRTIM_ADCTRIGGER_1: |
mbed_official | 237:f3da66175598 | 3649 | { |
mbed_official | 237:f3da66175598 | 3650 | hrtim_cr1 &= ~(HRTIM_CR1_ADC1USRC); |
mbed_official | 237:f3da66175598 | 3651 | hrtim_cr1 |= (pADCTriggerCfg->UpdateSource & HRTIM_CR1_ADC1USRC); |
mbed_official | 237:f3da66175598 | 3652 | |
mbed_official | 237:f3da66175598 | 3653 | /* Set the ADC trigger 1 source */ |
mbed_official | 237:f3da66175598 | 3654 | hhrtim->Instance->sCommonRegs.ADC1R = pADCTriggerCfg->Trigger; |
mbed_official | 237:f3da66175598 | 3655 | } |
mbed_official | 237:f3da66175598 | 3656 | break; |
mbed_official | 237:f3da66175598 | 3657 | case HRTIM_ADCTRIGGER_2: |
mbed_official | 237:f3da66175598 | 3658 | { |
mbed_official | 237:f3da66175598 | 3659 | hrtim_cr1 &= ~(HRTIM_CR1_ADC2USRC); |
mbed_official | 237:f3da66175598 | 3660 | hrtim_cr1 |= ((pADCTriggerCfg->UpdateSource << 3) & HRTIM_CR1_ADC2USRC); |
mbed_official | 237:f3da66175598 | 3661 | |
mbed_official | 237:f3da66175598 | 3662 | /* Set the ADC trigger 2 source */ |
mbed_official | 237:f3da66175598 | 3663 | hhrtim->Instance->sCommonRegs.ADC2R = pADCTriggerCfg->Trigger; |
mbed_official | 237:f3da66175598 | 3664 | } |
mbed_official | 237:f3da66175598 | 3665 | break; |
mbed_official | 237:f3da66175598 | 3666 | case HRTIM_ADCTRIGGER_3: |
mbed_official | 237:f3da66175598 | 3667 | { |
mbed_official | 237:f3da66175598 | 3668 | hrtim_cr1 &= ~(HRTIM_CR1_ADC3USRC); |
mbed_official | 237:f3da66175598 | 3669 | hrtim_cr1 |= ((pADCTriggerCfg->UpdateSource << 6) & HRTIM_CR1_ADC3USRC); |
mbed_official | 237:f3da66175598 | 3670 | |
mbed_official | 237:f3da66175598 | 3671 | /* Set the ADC trigger 3 source */ |
mbed_official | 237:f3da66175598 | 3672 | hhrtim->Instance->sCommonRegs.ADC3R = pADCTriggerCfg->Trigger; |
mbed_official | 237:f3da66175598 | 3673 | } |
mbed_official | 237:f3da66175598 | 3674 | break; |
mbed_official | 237:f3da66175598 | 3675 | case HRTIM_ADCTRIGGER_4: |
mbed_official | 237:f3da66175598 | 3676 | { |
mbed_official | 237:f3da66175598 | 3677 | hrtim_cr1 &= ~(HRTIM_CR1_ADC4USRC); |
mbed_official | 237:f3da66175598 | 3678 | hrtim_cr1 |= ((pADCTriggerCfg->UpdateSource << 9) & HRTIM_CR1_ADC4USRC); |
mbed_official | 237:f3da66175598 | 3679 | |
mbed_official | 237:f3da66175598 | 3680 | /* Set the ADC trigger 4 source */ |
mbed_official | 237:f3da66175598 | 3681 | hhrtim->Instance->sCommonRegs.ADC4R = pADCTriggerCfg->Trigger; |
mbed_official | 237:f3da66175598 | 3682 | } |
mbed_official | 237:f3da66175598 | 3683 | break; |
mbed_official | 237:f3da66175598 | 3684 | } |
mbed_official | 237:f3da66175598 | 3685 | |
mbed_official | 237:f3da66175598 | 3686 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 3687 | hhrtim->Instance->sCommonRegs.CR1 = hrtim_cr1; |
mbed_official | 237:f3da66175598 | 3688 | |
mbed_official | 237:f3da66175598 | 3689 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 3690 | |
mbed_official | 237:f3da66175598 | 3691 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 3692 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3693 | |
mbed_official | 237:f3da66175598 | 3694 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 3695 | } |
mbed_official | 237:f3da66175598 | 3696 | |
mbed_official | 237:f3da66175598 | 3697 | /** |
mbed_official | 237:f3da66175598 | 3698 | * @} |
mbed_official | 237:f3da66175598 | 3699 | */ |
mbed_official | 237:f3da66175598 | 3700 | |
mbed_official | 237:f3da66175598 | 3701 | /** @defgroup HAL_HRTIM_Group8 HRTIM timer configuration and functions |
mbed_official | 237:f3da66175598 | 3702 | * @brief Functions used to configure and control a HRTIM timer |
mbed_official | 237:f3da66175598 | 3703 | * operating in waveform mode. |
mbed_official | 237:f3da66175598 | 3704 | * |
mbed_official | 237:f3da66175598 | 3705 | @verbatim |
mbed_official | 237:f3da66175598 | 3706 | =============================================================================== |
mbed_official | 237:f3da66175598 | 3707 | ##### HRTIM timer configuration and control functions ##### |
mbed_official | 237:f3da66175598 | 3708 | =============================================================================== |
mbed_official | 237:f3da66175598 | 3709 | [..] This section provides functions allowing to: |
mbed_official | 237:f3da66175598 | 3710 | (+) Configure HRTIM timer general behavior |
mbed_official | 237:f3da66175598 | 3711 | (+) Configure HRTIM timer event filtering |
mbed_official | 237:f3da66175598 | 3712 | (+) Configure HRTIM timer deadtime insertion |
mbed_official | 237:f3da66175598 | 3713 | (+) Configure HRTIM timer chopper mode |
mbed_official | 237:f3da66175598 | 3714 | (+) Configure HRTIM timer burst DMA |
mbed_official | 237:f3da66175598 | 3715 | (+) Configure HRTIM timer compare unit |
mbed_official | 237:f3da66175598 | 3716 | (+) Configure HRTIM timer capture unit |
mbed_official | 237:f3da66175598 | 3717 | (+) Configure HRTIM timer output |
mbed_official | 237:f3da66175598 | 3718 | (+) Set HRTIM timer output level |
mbed_official | 237:f3da66175598 | 3719 | (+) Enable HRTIM timer output |
mbed_official | 237:f3da66175598 | 3720 | (+) Disable HRTIM timer output |
mbed_official | 237:f3da66175598 | 3721 | (+) Start HRTIM timer |
mbed_official | 237:f3da66175598 | 3722 | (+) Stop HRTIM timer |
mbed_official | 237:f3da66175598 | 3723 | (+) Start HRTIM timer and enable interrupt |
mbed_official | 237:f3da66175598 | 3724 | (+) Stop HRTIM timer and disable interrupt |
mbed_official | 237:f3da66175598 | 3725 | (+) Start HRTIM timer and enable DMA transfer |
mbed_official | 237:f3da66175598 | 3726 | (+) Stop HRTIM timer and disable DMA transfer |
mbed_official | 237:f3da66175598 | 3727 | (+) Enable or disable the burst mode controller |
mbed_official | 237:f3da66175598 | 3728 | (+) Start the burst mode controller (by software) |
mbed_official | 237:f3da66175598 | 3729 | (+) Trigger a Capture (by software) |
mbed_official | 237:f3da66175598 | 3730 | (+) Update the HRTIM timer preloadable registers (by software) |
mbed_official | 237:f3da66175598 | 3731 | (+) Reset the HRTIM timer counter (by software) |
mbed_official | 237:f3da66175598 | 3732 | (+) Start a burst DMA transfer |
mbed_official | 237:f3da66175598 | 3733 | (+) Enable timer register update |
mbed_official | 237:f3da66175598 | 3734 | (+) Disable timer register update |
mbed_official | 237:f3da66175598 | 3735 | |
mbed_official | 237:f3da66175598 | 3736 | @endverbatim |
mbed_official | 237:f3da66175598 | 3737 | * @{ |
mbed_official | 237:f3da66175598 | 3738 | */ |
mbed_official | 237:f3da66175598 | 3739 | |
mbed_official | 237:f3da66175598 | 3740 | /** |
mbed_official | 237:f3da66175598 | 3741 | * @brief Configures the general behavior of a timer operating in waveform mode |
mbed_official | 237:f3da66175598 | 3742 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 3743 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 3744 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3745 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 3746 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 3747 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 3748 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 3749 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 3750 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 3751 | * @param pTimerCfg: pointer to the timer configuration structure |
mbed_official | 237:f3da66175598 | 3752 | * @note When the timer operates in waveform mode, all the features supported by |
mbed_official | 237:f3da66175598 | 3753 | * the HRTIM are available without any limitation. |
mbed_official | 237:f3da66175598 | 3754 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 3755 | * @note This function must be called before starting the timer |
mbed_official | 237:f3da66175598 | 3756 | */ |
mbed_official | 237:f3da66175598 | 3757 | HAL_StatusTypeDef HAL_HRTIM_WaveformTimerConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 3758 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 3759 | HRTIM_TimerCfgTypeDef * pTimerCfg) |
mbed_official | 237:f3da66175598 | 3760 | { |
mbed_official | 237:f3da66175598 | 3761 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 3762 | assert_param(IS_HRTIM_TIMERINDEX(TimerIdx)); |
mbed_official | 237:f3da66175598 | 3763 | |
mbed_official | 237:f3da66175598 | 3764 | /* Relevant for all HRTIM timers, including the master */ |
mbed_official | 237:f3da66175598 | 3765 | assert_param(IS_HRTIM_HALFMODE(pTimerCfg->HalfModeEnable)); |
mbed_official | 237:f3da66175598 | 3766 | assert_param(IS_HRTIM_SYNCSTART(pTimerCfg->StartOnSync)); |
mbed_official | 237:f3da66175598 | 3767 | assert_param(IS_HRTIM_SYNCRESET(pTimerCfg->ResetOnSync)); |
mbed_official | 237:f3da66175598 | 3768 | assert_param(IS_HHRTIM_DACSYNC(pTimerCfg->DACSynchro)); |
mbed_official | 237:f3da66175598 | 3769 | assert_param(IS_HRTIM_PRELOAD(pTimerCfg->PreloadEnable)); |
mbed_official | 237:f3da66175598 | 3770 | assert_param(IS_HRTIM_TIMERBURSTMODE(pTimerCfg->BurstMode)); |
mbed_official | 237:f3da66175598 | 3771 | assert_param(IS_HRTIM_UPDATEONREPETITION(pTimerCfg->RepetitionUpdate)); |
mbed_official | 237:f3da66175598 | 3772 | |
mbed_official | 237:f3da66175598 | 3773 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 3774 | { |
mbed_official | 237:f3da66175598 | 3775 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 3776 | } |
mbed_official | 237:f3da66175598 | 3777 | |
mbed_official | 237:f3da66175598 | 3778 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 3779 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3780 | |
mbed_official | 237:f3da66175598 | 3781 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 3782 | |
mbed_official | 237:f3da66175598 | 3783 | if (TimerIdx == HRTIM_TIMERINDEX_MASTER) |
mbed_official | 237:f3da66175598 | 3784 | { |
mbed_official | 237:f3da66175598 | 3785 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 3786 | assert_param(IS_HRTIM_UPDATEGATING_MASTER(pTimerCfg->UpdateGating)); |
mbed_official | 237:f3da66175598 | 3787 | assert_param(IS_HRTIM_MASTER_IT(pTimerCfg->InterruptRequests)); |
mbed_official | 237:f3da66175598 | 3788 | assert_param(IS_HRTIM_MASTER_DMA(pTimerCfg->DMARequests)); |
mbed_official | 237:f3da66175598 | 3789 | |
mbed_official | 237:f3da66175598 | 3790 | /* Configure master timer */ |
mbed_official | 237:f3da66175598 | 3791 | HRTIM_MasterWaveform_Config(hhrtim, pTimerCfg); |
mbed_official | 237:f3da66175598 | 3792 | } |
mbed_official | 237:f3da66175598 | 3793 | else |
mbed_official | 237:f3da66175598 | 3794 | { |
mbed_official | 237:f3da66175598 | 3795 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 3796 | assert_param(IS_HRTIM_UPDATEGATING_TIM(pTimerCfg->UpdateGating)); |
mbed_official | 237:f3da66175598 | 3797 | assert_param(IS_HRTIM_TIM_IT(pTimerCfg->InterruptRequests)); |
mbed_official | 237:f3da66175598 | 3798 | assert_param(IS_HRTIM_TIM_DMA(pTimerCfg->DMARequests)); |
mbed_official | 237:f3da66175598 | 3799 | assert_param(IS_HRTIM_TIMPUSHPULLMODE(pTimerCfg->PushPull)); |
mbed_official | 237:f3da66175598 | 3800 | assert_param(IS_HRTIM_TIMFAULTENABLE(pTimerCfg->FaultEnable)); |
mbed_official | 237:f3da66175598 | 3801 | assert_param(IS_HRTIM_TIMFAULTLOCK(pTimerCfg->FaultLock)); |
mbed_official | 237:f3da66175598 | 3802 | assert_param(IS_HRTIM_TIMDEADTIMEINSERTION(pTimerCfg->PushPull, |
mbed_official | 237:f3da66175598 | 3803 | pTimerCfg->DeadTimeInsertion)); |
mbed_official | 237:f3da66175598 | 3804 | assert_param(IS_HRTIM_TIMDELAYEDPROTECTION(pTimerCfg->PushPull, |
mbed_official | 237:f3da66175598 | 3805 | pTimerCfg->DelayedProtectionMode)); |
mbed_official | 237:f3da66175598 | 3806 | assert_param(IS_HRTIM_TIMUPDATETRIGGER(pTimerCfg->UpdateTrigger)); |
mbed_official | 237:f3da66175598 | 3807 | assert_param(IS_HRTIM_TIMRESETTRIGGER(pTimerCfg->ResetTrigger)); |
mbed_official | 237:f3da66175598 | 3808 | assert_param(IS_HRTIM_TIMUPDATEONRESET(pTimerCfg->ResetUpdate)); |
mbed_official | 237:f3da66175598 | 3809 | |
mbed_official | 237:f3da66175598 | 3810 | /* Configure timing unit */ |
mbed_official | 237:f3da66175598 | 3811 | HRTIM_TimingUnitWaveform_Config(hhrtim, TimerIdx, pTimerCfg); |
mbed_official | 237:f3da66175598 | 3812 | } |
mbed_official | 237:f3da66175598 | 3813 | |
mbed_official | 237:f3da66175598 | 3814 | /* Update timer parameters */ |
mbed_official | 237:f3da66175598 | 3815 | hhrtim->TimerParam[TimerIdx].InterruptRequests = pTimerCfg->InterruptRequests; |
mbed_official | 237:f3da66175598 | 3816 | hhrtim->TimerParam[TimerIdx].DMARequests = pTimerCfg->DMARequests; |
mbed_official | 237:f3da66175598 | 3817 | hhrtim->TimerParam[TimerIdx].DMASrcAddress = pTimerCfg->DMASrcAddress; |
mbed_official | 237:f3da66175598 | 3818 | hhrtim->TimerParam[TimerIdx].DMADstAddress = pTimerCfg->DMADstAddress; |
mbed_official | 237:f3da66175598 | 3819 | hhrtim->TimerParam[TimerIdx].DMASize = pTimerCfg->DMASize; |
mbed_official | 237:f3da66175598 | 3820 | |
mbed_official | 237:f3da66175598 | 3821 | /* Force a software update */ |
mbed_official | 237:f3da66175598 | 3822 | HRTIM_ForceRegistersUpdate(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 3823 | |
mbed_official | 237:f3da66175598 | 3824 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 3825 | |
mbed_official | 237:f3da66175598 | 3826 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 3827 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3828 | |
mbed_official | 237:f3da66175598 | 3829 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 3830 | } |
mbed_official | 237:f3da66175598 | 3831 | |
mbed_official | 237:f3da66175598 | 3832 | /** |
mbed_official | 237:f3da66175598 | 3833 | * @brief Configures the event filtering capabilities of a timer (blanking, windowing) |
mbed_official | 237:f3da66175598 | 3834 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 3835 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 3836 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3837 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 3838 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 3839 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 3840 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 3841 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 3842 | * @param Event: external event for which timer event filtering must be configured |
mbed_official | 237:f3da66175598 | 3843 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3844 | * @arg HRTIM_EVENT_NONE: Reset timer event filtering configuration |
mbed_official | 237:f3da66175598 | 3845 | * @arg HRTIM_EVENT_1: External event 1 |
mbed_official | 237:f3da66175598 | 3846 | * @arg HRTIM_EVENT_2: External event 2 |
mbed_official | 237:f3da66175598 | 3847 | * @arg HRTIM_EVENT_3: External event 3 |
mbed_official | 237:f3da66175598 | 3848 | * @arg HRTIM_EVENT_4: External event 4 |
mbed_official | 237:f3da66175598 | 3849 | * @arg HRTIM_EVENT_5: External event 5 |
mbed_official | 237:f3da66175598 | 3850 | * @arg HRTIM_EVENT_6: External event 6 |
mbed_official | 237:f3da66175598 | 3851 | * @arg HRTIM_EVENT_7: External event 7 |
mbed_official | 237:f3da66175598 | 3852 | * @arg HRTIM_EVENT_8: External event 8 |
mbed_official | 237:f3da66175598 | 3853 | * @arg HRTIM_EVENT_9: External event 9 |
mbed_official | 237:f3da66175598 | 3854 | * @arg HRTIM_EVENT_10: External event 10 |
mbed_official | 237:f3da66175598 | 3855 | * @param pTimerEventFilteringCfg: pointer to the timer event filtering configuration structure |
mbed_official | 237:f3da66175598 | 3856 | * @note This function must be called before starting the timer |
mbed_official | 237:f3da66175598 | 3857 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 3858 | */ |
mbed_official | 237:f3da66175598 | 3859 | HAL_StatusTypeDef HAL_HRTIM_TimerEventFilteringConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 3860 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 3861 | uint32_t Event, |
mbed_official | 237:f3da66175598 | 3862 | HRTIM_TimerEventFilteringCfgTypeDef* pTimerEventFilteringCfg) |
mbed_official | 237:f3da66175598 | 3863 | { |
mbed_official | 237:f3da66175598 | 3864 | uint32_t hrtim_eefr; |
mbed_official | 237:f3da66175598 | 3865 | |
mbed_official | 237:f3da66175598 | 3866 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 3867 | assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); |
mbed_official | 237:f3da66175598 | 3868 | assert_param(IS_HRTIM_EVENT(Event)); |
mbed_official | 237:f3da66175598 | 3869 | assert_param(IS_HRTIM_TIMEVENTFILTER(pTimerEventFilteringCfg->Filter)); |
mbed_official | 237:f3da66175598 | 3870 | assert_param(IS_HRTIM_TIMEVENTLATCH(pTimerEventFilteringCfg->Latch)); |
mbed_official | 237:f3da66175598 | 3871 | |
mbed_official | 237:f3da66175598 | 3872 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 3873 | { |
mbed_official | 237:f3da66175598 | 3874 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 3875 | } |
mbed_official | 237:f3da66175598 | 3876 | |
mbed_official | 237:f3da66175598 | 3877 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 3878 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3879 | |
mbed_official | 237:f3da66175598 | 3880 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 3881 | |
mbed_official | 237:f3da66175598 | 3882 | /* Configure timer event filtering capabilities */ |
mbed_official | 237:f3da66175598 | 3883 | switch (Event) |
mbed_official | 237:f3da66175598 | 3884 | { |
mbed_official | 237:f3da66175598 | 3885 | case HRTIM_EVENT_NONE: |
mbed_official | 237:f3da66175598 | 3886 | { |
mbed_official | 237:f3da66175598 | 3887 | hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR1 = 0; |
mbed_official | 237:f3da66175598 | 3888 | hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR2 = 0; |
mbed_official | 237:f3da66175598 | 3889 | } |
mbed_official | 237:f3da66175598 | 3890 | break; |
mbed_official | 237:f3da66175598 | 3891 | case HRTIM_EVENT_1: |
mbed_official | 237:f3da66175598 | 3892 | { |
mbed_official | 237:f3da66175598 | 3893 | hrtim_eefr = hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR1; |
mbed_official | 237:f3da66175598 | 3894 | hrtim_eefr &= ~(HRTIM_EEFR1_EE1FLTR | HRTIM_EEFR1_EE1LTCH); |
mbed_official | 237:f3da66175598 | 3895 | hrtim_eefr |= (pTimerEventFilteringCfg->Filter | pTimerEventFilteringCfg->Latch); |
mbed_official | 237:f3da66175598 | 3896 | hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR1 = hrtim_eefr; |
mbed_official | 237:f3da66175598 | 3897 | } |
mbed_official | 237:f3da66175598 | 3898 | break; |
mbed_official | 237:f3da66175598 | 3899 | case HRTIM_EVENT_2: |
mbed_official | 237:f3da66175598 | 3900 | { |
mbed_official | 237:f3da66175598 | 3901 | hrtim_eefr = hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR1; |
mbed_official | 237:f3da66175598 | 3902 | hrtim_eefr &= ~(HRTIM_EEFR1_EE2FLTR | HRTIM_EEFR1_EE2LTCH); |
mbed_official | 237:f3da66175598 | 3903 | hrtim_eefr |= ((pTimerEventFilteringCfg->Filter | pTimerEventFilteringCfg->Latch) << 6); |
mbed_official | 237:f3da66175598 | 3904 | hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR1 = hrtim_eefr; |
mbed_official | 237:f3da66175598 | 3905 | } |
mbed_official | 237:f3da66175598 | 3906 | break; |
mbed_official | 237:f3da66175598 | 3907 | case HRTIM_EVENT_3: |
mbed_official | 237:f3da66175598 | 3908 | { |
mbed_official | 237:f3da66175598 | 3909 | hrtim_eefr = hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR1; |
mbed_official | 237:f3da66175598 | 3910 | hrtim_eefr &= ~(HRTIM_EEFR1_EE3FLTR | HRTIM_EEFR1_EE3LTCH); |
mbed_official | 237:f3da66175598 | 3911 | hrtim_eefr |= ((pTimerEventFilteringCfg->Filter | pTimerEventFilteringCfg->Latch) << 12); |
mbed_official | 237:f3da66175598 | 3912 | hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR1 = hrtim_eefr; |
mbed_official | 237:f3da66175598 | 3913 | } |
mbed_official | 237:f3da66175598 | 3914 | break; |
mbed_official | 237:f3da66175598 | 3915 | case HRTIM_EVENT_4: |
mbed_official | 237:f3da66175598 | 3916 | { |
mbed_official | 237:f3da66175598 | 3917 | hrtim_eefr = hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR1; |
mbed_official | 237:f3da66175598 | 3918 | hrtim_eefr &= ~(HRTIM_EEFR1_EE4FLTR | HRTIM_EEFR1_EE4LTCH); |
mbed_official | 237:f3da66175598 | 3919 | hrtim_eefr |= ((pTimerEventFilteringCfg->Filter | pTimerEventFilteringCfg->Latch) << 18); |
mbed_official | 237:f3da66175598 | 3920 | hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR1 = hrtim_eefr; |
mbed_official | 237:f3da66175598 | 3921 | } |
mbed_official | 237:f3da66175598 | 3922 | break; |
mbed_official | 237:f3da66175598 | 3923 | case HRTIM_EVENT_5: |
mbed_official | 237:f3da66175598 | 3924 | { |
mbed_official | 237:f3da66175598 | 3925 | hrtim_eefr = hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR1; |
mbed_official | 237:f3da66175598 | 3926 | hrtim_eefr &= ~(HRTIM_EEFR1_EE5FLTR | HRTIM_EEFR1_EE5LTCH); |
mbed_official | 237:f3da66175598 | 3927 | hrtim_eefr |= ((pTimerEventFilteringCfg->Filter | pTimerEventFilteringCfg->Latch) << 24); |
mbed_official | 237:f3da66175598 | 3928 | hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR1 = hrtim_eefr; |
mbed_official | 237:f3da66175598 | 3929 | } |
mbed_official | 237:f3da66175598 | 3930 | break; |
mbed_official | 237:f3da66175598 | 3931 | case HRTIM_EVENT_6: |
mbed_official | 237:f3da66175598 | 3932 | { |
mbed_official | 237:f3da66175598 | 3933 | hrtim_eefr = hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR2; |
mbed_official | 237:f3da66175598 | 3934 | hrtim_eefr &= ~(HRTIM_EEFR2_EE6FLTR | HRTIM_EEFR2_EE6LTCH); |
mbed_official | 237:f3da66175598 | 3935 | hrtim_eefr |= (pTimerEventFilteringCfg->Filter | pTimerEventFilteringCfg->Latch); |
mbed_official | 237:f3da66175598 | 3936 | hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR2 = hrtim_eefr; |
mbed_official | 237:f3da66175598 | 3937 | } |
mbed_official | 237:f3da66175598 | 3938 | break; |
mbed_official | 237:f3da66175598 | 3939 | case HRTIM_EVENT_7: |
mbed_official | 237:f3da66175598 | 3940 | { |
mbed_official | 237:f3da66175598 | 3941 | hrtim_eefr = hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR2; |
mbed_official | 237:f3da66175598 | 3942 | hrtim_eefr &= ~(HRTIM_EEFR2_EE7FLTR | HRTIM_EEFR2_EE7LTCH); |
mbed_official | 237:f3da66175598 | 3943 | hrtim_eefr |= ((pTimerEventFilteringCfg->Filter | pTimerEventFilteringCfg->Latch) << 6); |
mbed_official | 237:f3da66175598 | 3944 | hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR2 = hrtim_eefr; |
mbed_official | 237:f3da66175598 | 3945 | } |
mbed_official | 237:f3da66175598 | 3946 | break; |
mbed_official | 237:f3da66175598 | 3947 | case HRTIM_EVENT_8: |
mbed_official | 237:f3da66175598 | 3948 | { |
mbed_official | 237:f3da66175598 | 3949 | hrtim_eefr = hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR2; |
mbed_official | 237:f3da66175598 | 3950 | hrtim_eefr &= ~(HRTIM_EEFR2_EE8FLTR | HRTIM_EEFR2_EE8LTCH); |
mbed_official | 237:f3da66175598 | 3951 | hrtim_eefr |= ((pTimerEventFilteringCfg->Filter | pTimerEventFilteringCfg->Latch) << 12); |
mbed_official | 237:f3da66175598 | 3952 | hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR2 = hrtim_eefr; |
mbed_official | 237:f3da66175598 | 3953 | } |
mbed_official | 237:f3da66175598 | 3954 | break; |
mbed_official | 237:f3da66175598 | 3955 | case HRTIM_EVENT_9: |
mbed_official | 237:f3da66175598 | 3956 | { |
mbed_official | 237:f3da66175598 | 3957 | hrtim_eefr = hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR2; |
mbed_official | 237:f3da66175598 | 3958 | hrtim_eefr &= ~(HRTIM_EEFR2_EE9FLTR | HRTIM_EEFR2_EE9LTCH); |
mbed_official | 237:f3da66175598 | 3959 | hrtim_eefr |= ((pTimerEventFilteringCfg->Filter | pTimerEventFilteringCfg->Latch) << 18); |
mbed_official | 237:f3da66175598 | 3960 | hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR2 = hrtim_eefr; |
mbed_official | 237:f3da66175598 | 3961 | } |
mbed_official | 237:f3da66175598 | 3962 | break; |
mbed_official | 237:f3da66175598 | 3963 | case HRTIM_EVENT_10: |
mbed_official | 237:f3da66175598 | 3964 | { |
mbed_official | 237:f3da66175598 | 3965 | hrtim_eefr = hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR2; |
mbed_official | 237:f3da66175598 | 3966 | hrtim_eefr &= ~(HRTIM_EEFR2_EE10FLTR | HRTIM_EEFR2_EE10LTCH); |
mbed_official | 237:f3da66175598 | 3967 | hrtim_eefr |= ((pTimerEventFilteringCfg->Filter | pTimerEventFilteringCfg->Latch) << 24); |
mbed_official | 237:f3da66175598 | 3968 | hhrtim->Instance->sTimerxRegs[TimerIdx].EEFxR2 = hrtim_eefr; |
mbed_official | 237:f3da66175598 | 3969 | } |
mbed_official | 237:f3da66175598 | 3970 | break; |
mbed_official | 237:f3da66175598 | 3971 | } |
mbed_official | 237:f3da66175598 | 3972 | |
mbed_official | 237:f3da66175598 | 3973 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 3974 | |
mbed_official | 237:f3da66175598 | 3975 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 3976 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 3977 | |
mbed_official | 237:f3da66175598 | 3978 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 3979 | } |
mbed_official | 237:f3da66175598 | 3980 | |
mbed_official | 237:f3da66175598 | 3981 | /** |
mbed_official | 237:f3da66175598 | 3982 | * @brief Configures the deadtime insertion feature for a timer |
mbed_official | 237:f3da66175598 | 3983 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 3984 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 3985 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 3986 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 3987 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 3988 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 3989 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 3990 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 3991 | * @param pDeadTimeCfg: pointer to the deadtime insertion configuration structure |
mbed_official | 237:f3da66175598 | 3992 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 3993 | * @note This function must be called before starting the timer |
mbed_official | 237:f3da66175598 | 3994 | */ |
mbed_official | 237:f3da66175598 | 3995 | HAL_StatusTypeDef HAL_HRTIM_DeadTimeConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 3996 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 3997 | HRTIM_DeadTimeCfgTypeDef* pDeadTimeCfg) |
mbed_official | 237:f3da66175598 | 3998 | { |
mbed_official | 237:f3da66175598 | 3999 | uint32_t hrtim_dtr; |
mbed_official | 237:f3da66175598 | 4000 | |
mbed_official | 237:f3da66175598 | 4001 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 4002 | assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); |
mbed_official | 237:f3da66175598 | 4003 | assert_param(IS_HRTIM_TIMDEADTIME_PRESCALERRATIO(pDeadTimeCfg->Prescaler)); |
mbed_official | 237:f3da66175598 | 4004 | assert_param(IS_HRTIM_TIMDEADTIME_RISINGSIGN(pDeadTimeCfg->RisingSign)); |
mbed_official | 237:f3da66175598 | 4005 | assert_param(IS_HRTIM_TIMDEADTIME_RISINGLOCK(pDeadTimeCfg->RisingLock)); |
mbed_official | 237:f3da66175598 | 4006 | assert_param(IS_HRTIM_TIMDEADTIME_RISINGSIGNLOCK(pDeadTimeCfg->RisingSignLock)); |
mbed_official | 237:f3da66175598 | 4007 | assert_param(IS_HRTIM_TIMDEADTIME_FALLINGSIGN(pDeadTimeCfg->FallingSign)); |
mbed_official | 237:f3da66175598 | 4008 | assert_param(IS_HRTIM_TIMDEADTIME_FALLINGLOCK(pDeadTimeCfg->FallingLock)); |
mbed_official | 237:f3da66175598 | 4009 | assert_param(IS_HRTIM_TIMDEADTIME_FALLINGSIGNLOCK(pDeadTimeCfg->FallingSignLock)); |
mbed_official | 237:f3da66175598 | 4010 | |
mbed_official | 237:f3da66175598 | 4011 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 4012 | { |
mbed_official | 237:f3da66175598 | 4013 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 4014 | } |
mbed_official | 237:f3da66175598 | 4015 | |
mbed_official | 237:f3da66175598 | 4016 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 4017 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4018 | |
mbed_official | 237:f3da66175598 | 4019 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4020 | |
mbed_official | 237:f3da66175598 | 4021 | hrtim_dtr = hhrtim->Instance->sTimerxRegs[TimerIdx].DTxR; |
mbed_official | 237:f3da66175598 | 4022 | |
mbed_official | 237:f3da66175598 | 4023 | /* Clear timer deadtime configuration */ |
mbed_official | 237:f3da66175598 | 4024 | hrtim_dtr &= ~(HRTIM_DTR_DTR | HRTIM_DTR_SDTR | HRTIM_DTR_DTPRSC | |
mbed_official | 237:f3da66175598 | 4025 | HRTIM_DTR_DTRSLK | HRTIM_DTR_DTRLK | HRTIM_DTR_DTF | |
mbed_official | 237:f3da66175598 | 4026 | HRTIM_DTR_SDTF | HRTIM_DTR_DTFSLK | HRTIM_DTR_DTFLK); |
mbed_official | 237:f3da66175598 | 4027 | |
mbed_official | 237:f3da66175598 | 4028 | /* Set timer deadtime configuration */ |
mbed_official | 237:f3da66175598 | 4029 | hrtim_dtr |= pDeadTimeCfg->Prescaler; |
mbed_official | 237:f3da66175598 | 4030 | hrtim_dtr |= pDeadTimeCfg->RisingValue; |
mbed_official | 237:f3da66175598 | 4031 | hrtim_dtr |= pDeadTimeCfg->RisingSign; |
mbed_official | 237:f3da66175598 | 4032 | hrtim_dtr |= pDeadTimeCfg->RisingSignLock; |
mbed_official | 237:f3da66175598 | 4033 | hrtim_dtr |= pDeadTimeCfg->RisingLock; |
mbed_official | 237:f3da66175598 | 4034 | hrtim_dtr |= (pDeadTimeCfg->FallingValue << 16); |
mbed_official | 237:f3da66175598 | 4035 | hrtim_dtr |= pDeadTimeCfg->FallingSign; |
mbed_official | 237:f3da66175598 | 4036 | hrtim_dtr |= pDeadTimeCfg->FallingSignLock; |
mbed_official | 237:f3da66175598 | 4037 | hrtim_dtr |= pDeadTimeCfg->FallingLock; |
mbed_official | 237:f3da66175598 | 4038 | |
mbed_official | 237:f3da66175598 | 4039 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 4040 | hhrtim->Instance->sTimerxRegs[TimerIdx].DTxR = hrtim_dtr; |
mbed_official | 237:f3da66175598 | 4041 | |
mbed_official | 237:f3da66175598 | 4042 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 4043 | |
mbed_official | 237:f3da66175598 | 4044 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 4045 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4046 | |
mbed_official | 237:f3da66175598 | 4047 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 4048 | } |
mbed_official | 237:f3da66175598 | 4049 | |
mbed_official | 237:f3da66175598 | 4050 | /** |
mbed_official | 237:f3da66175598 | 4051 | * @brief Configures the chopper mode feature for a timer |
mbed_official | 237:f3da66175598 | 4052 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 4053 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 4054 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 4055 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 4056 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 4057 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 4058 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 4059 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 4060 | * @param pChopperModeCfg: pointer to the chopper mode configuration structure |
mbed_official | 237:f3da66175598 | 4061 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 4062 | * @note This function must be called before configuring the timer output(s) |
mbed_official | 237:f3da66175598 | 4063 | */ |
mbed_official | 237:f3da66175598 | 4064 | HAL_StatusTypeDef HAL_HRTIM_ChopperModeConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 4065 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 4066 | HRTIM_ChopperModeCfgTypeDef* pChopperModeCfg) |
mbed_official | 237:f3da66175598 | 4067 | { |
mbed_official | 237:f3da66175598 | 4068 | uint32_t hrtim_chpr; |
mbed_official | 237:f3da66175598 | 4069 | |
mbed_official | 237:f3da66175598 | 4070 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 4071 | assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); |
mbed_official | 237:f3da66175598 | 4072 | assert_param(IS_HRTIM_CHOPPER_PRESCALERRATIO(pChopperModeCfg->CarrierFreq)); |
mbed_official | 237:f3da66175598 | 4073 | assert_param(IS_HRTIM_CHOPPER_DUTYCYCLE(pChopperModeCfg->DutyCycle)); |
mbed_official | 237:f3da66175598 | 4074 | assert_param(IS_HRTIM_CHOPPER_PULSEWIDTH(pChopperModeCfg->StartPulse)); |
mbed_official | 237:f3da66175598 | 4075 | |
mbed_official | 237:f3da66175598 | 4076 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 4077 | { |
mbed_official | 237:f3da66175598 | 4078 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 4079 | } |
mbed_official | 237:f3da66175598 | 4080 | |
mbed_official | 237:f3da66175598 | 4081 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 4082 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4083 | |
mbed_official | 237:f3da66175598 | 4084 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4085 | |
mbed_official | 237:f3da66175598 | 4086 | hrtim_chpr = hhrtim->Instance->sTimerxRegs[TimerIdx].CHPxR; |
mbed_official | 237:f3da66175598 | 4087 | |
mbed_official | 237:f3da66175598 | 4088 | /* Clear timer chopper mode configuration */ |
mbed_official | 237:f3da66175598 | 4089 | hrtim_chpr &= ~(HRTIM_CHPR_CARFRQ | HRTIM_CHPR_CARDTY | HRTIM_CHPR_STRPW); |
mbed_official | 237:f3da66175598 | 4090 | |
mbed_official | 237:f3da66175598 | 4091 | /* Set timer choppe mode configuration */ |
mbed_official | 237:f3da66175598 | 4092 | hrtim_chpr |= pChopperModeCfg->CarrierFreq; |
mbed_official | 237:f3da66175598 | 4093 | hrtim_chpr |= (pChopperModeCfg->DutyCycle); |
mbed_official | 237:f3da66175598 | 4094 | hrtim_chpr |= (pChopperModeCfg->StartPulse); |
mbed_official | 237:f3da66175598 | 4095 | |
mbed_official | 237:f3da66175598 | 4096 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 4097 | hhrtim->Instance->sTimerxRegs[TimerIdx].CHPxR = hrtim_chpr; |
mbed_official | 237:f3da66175598 | 4098 | |
mbed_official | 237:f3da66175598 | 4099 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 4100 | |
mbed_official | 237:f3da66175598 | 4101 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 4102 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4103 | |
mbed_official | 237:f3da66175598 | 4104 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 4105 | } |
mbed_official | 237:f3da66175598 | 4106 | |
mbed_official | 237:f3da66175598 | 4107 | /** |
mbed_official | 237:f3da66175598 | 4108 | * @brief Configures the burst DMA controller for a timer |
mbed_official | 237:f3da66175598 | 4109 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 4110 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 4111 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 4112 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 4113 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 4114 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 4115 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 4116 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 4117 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 4118 | * @param RegistersToUpdate: registers to be written by DMA |
mbed_official | 237:f3da66175598 | 4119 | * This parameter can be any combination of the following values: |
mbed_official | 237:f3da66175598 | 4120 | * @arg HRTIM_BURSTDMA_CR: HRTIM_MCR or HRTIM_TIMxCR |
mbed_official | 237:f3da66175598 | 4121 | * @arg HRTIM_BURSTDMA_ICR: HRTIM_MICR or HRTIM_TIMxICR |
mbed_official | 237:f3da66175598 | 4122 | * @arg HRTIM_BURSTDMA_DIER: HRTIM_MDIER or HRTIM_TIMxDIER |
mbed_official | 237:f3da66175598 | 4123 | * @arg HRTIM_BURSTDMA_CNT: HRTIM_MCNT or HRTIM_TIMxCNT |
mbed_official | 237:f3da66175598 | 4124 | * @arg HRTIM_BURSTDMA_PER: HRTIM_MPER or HRTIM_TIMxPER |
mbed_official | 237:f3da66175598 | 4125 | * @arg HRTIM_BURSTDMA_REP: HRTIM_MREP or HRTIM_TIMxREP |
mbed_official | 237:f3da66175598 | 4126 | * @arg HRTIM_BURSTDMA_CMP1: HRTIM_MCMP1 or HRTIM_TIMxCMP1 |
mbed_official | 237:f3da66175598 | 4127 | * @arg HRTIM_BURSTDMA_CMP2: HRTIM_MCMP2 or HRTIM_TIMxCMP2 |
mbed_official | 237:f3da66175598 | 4128 | * @arg HRTIM_BURSTDMA_CMP3: HRTIM_MCMP3 or HRTIM_TIMxCMP3 |
mbed_official | 237:f3da66175598 | 4129 | * @arg HRTIM_BURSTDMA_CMP4: HRTIM_MCMP4 or HRTIM_TIMxCMP4 |
mbed_official | 237:f3da66175598 | 4130 | * @arg HRTIM_BURSTDMA_DTR: HRTIM_TIMxDTR |
mbed_official | 237:f3da66175598 | 4131 | * @arg HRTIM_BURSTDMA_SET1R: HRTIM_TIMxSET1R |
mbed_official | 237:f3da66175598 | 4132 | * @arg HRTIM_BURSTDMA_RST1R: HRTIM_TIMxRST1R |
mbed_official | 237:f3da66175598 | 4133 | * @arg HRTIM_BURSTDMA_SET2R: HRTIM_TIMxSET2R |
mbed_official | 237:f3da66175598 | 4134 | * @arg HRTIM_BURSTDMA_RST2R: HRTIM_TIMxRST2R |
mbed_official | 237:f3da66175598 | 4135 | * @arg HRTIM_BURSTDMA_EEFR1: HRTIM_TIMxEEFR1 |
mbed_official | 237:f3da66175598 | 4136 | * @arg HRTIM_BURSTDMA_EEFR2: HRTIM_TIMxEEFR2 |
mbed_official | 237:f3da66175598 | 4137 | * @arg HRTIM_BURSTDMA_RSTR: HRTIM_TIMxRSTR |
mbed_official | 237:f3da66175598 | 4138 | * @arg HRTIM_BURSTDMA_CHPR: HRTIM_TIMxCHPR |
mbed_official | 237:f3da66175598 | 4139 | * @arg HRTIM_BURSTDMA_OUTR: HRTIM_TIMxOUTR |
mbed_official | 237:f3da66175598 | 4140 | * @arg HRTIM_BURSTDMA_FLTR: HRTIM_TIMxFLTR |
mbed_official | 237:f3da66175598 | 4141 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 4142 | * @note This function must be called before starting the timer |
mbed_official | 237:f3da66175598 | 4143 | */ |
mbed_official | 237:f3da66175598 | 4144 | HAL_StatusTypeDef HAL_HRTIM_BurstDMAConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 4145 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 4146 | uint32_t RegistersToUpdate) |
mbed_official | 237:f3da66175598 | 4147 | { |
mbed_official | 237:f3da66175598 | 4148 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 4149 | assert_param(IS_HRTIM_TIMER_BURSTDMA(TimerIdx, RegistersToUpdate)); |
mbed_official | 237:f3da66175598 | 4150 | |
mbed_official | 237:f3da66175598 | 4151 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 4152 | { |
mbed_official | 237:f3da66175598 | 4153 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 4154 | } |
mbed_official | 237:f3da66175598 | 4155 | |
mbed_official | 237:f3da66175598 | 4156 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 4157 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4158 | |
mbed_official | 237:f3da66175598 | 4159 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4160 | |
mbed_official | 237:f3da66175598 | 4161 | /* Set the burst DMA timer update register */ |
mbed_official | 237:f3da66175598 | 4162 | switch (TimerIdx) |
mbed_official | 237:f3da66175598 | 4163 | { |
mbed_official | 237:f3da66175598 | 4164 | case HRTIM_TIMERINDEX_TIMER_A: |
mbed_official | 237:f3da66175598 | 4165 | { |
mbed_official | 237:f3da66175598 | 4166 | hhrtim->Instance->sCommonRegs.BDTAUPR = RegistersToUpdate; |
mbed_official | 237:f3da66175598 | 4167 | } |
mbed_official | 237:f3da66175598 | 4168 | break; |
mbed_official | 237:f3da66175598 | 4169 | case HRTIM_TIMERINDEX_TIMER_B: |
mbed_official | 237:f3da66175598 | 4170 | { |
mbed_official | 237:f3da66175598 | 4171 | hhrtim->Instance->sCommonRegs.BDTBUPR = RegistersToUpdate; |
mbed_official | 237:f3da66175598 | 4172 | } |
mbed_official | 237:f3da66175598 | 4173 | break; |
mbed_official | 237:f3da66175598 | 4174 | case HRTIM_TIMERINDEX_TIMER_C: |
mbed_official | 237:f3da66175598 | 4175 | { |
mbed_official | 237:f3da66175598 | 4176 | hhrtim->Instance->sCommonRegs.BDTCUPR = RegistersToUpdate; |
mbed_official | 237:f3da66175598 | 4177 | } |
mbed_official | 237:f3da66175598 | 4178 | break; |
mbed_official | 237:f3da66175598 | 4179 | case HRTIM_TIMERINDEX_TIMER_D: |
mbed_official | 237:f3da66175598 | 4180 | { |
mbed_official | 237:f3da66175598 | 4181 | hhrtim->Instance->sCommonRegs.BDTDUPR = RegistersToUpdate; |
mbed_official | 237:f3da66175598 | 4182 | } |
mbed_official | 237:f3da66175598 | 4183 | break; |
mbed_official | 237:f3da66175598 | 4184 | case HRTIM_TIMERINDEX_TIMER_E: |
mbed_official | 237:f3da66175598 | 4185 | { |
mbed_official | 237:f3da66175598 | 4186 | hhrtim->Instance->sCommonRegs.BDTEUPR = RegistersToUpdate; |
mbed_official | 237:f3da66175598 | 4187 | } |
mbed_official | 237:f3da66175598 | 4188 | break; |
mbed_official | 237:f3da66175598 | 4189 | case HRTIM_TIMERINDEX_MASTER: |
mbed_official | 237:f3da66175598 | 4190 | { |
mbed_official | 237:f3da66175598 | 4191 | hhrtim->Instance->sCommonRegs.BDMUPR = RegistersToUpdate; |
mbed_official | 237:f3da66175598 | 4192 | } |
mbed_official | 237:f3da66175598 | 4193 | break; |
mbed_official | 237:f3da66175598 | 4194 | } |
mbed_official | 237:f3da66175598 | 4195 | |
mbed_official | 237:f3da66175598 | 4196 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 4197 | |
mbed_official | 237:f3da66175598 | 4198 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 4199 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4200 | |
mbed_official | 237:f3da66175598 | 4201 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 4202 | } |
mbed_official | 237:f3da66175598 | 4203 | |
mbed_official | 237:f3da66175598 | 4204 | /** |
mbed_official | 237:f3da66175598 | 4205 | * @brief Configures the compare unit of a timer operating in waveform mode |
mbed_official | 237:f3da66175598 | 4206 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 4207 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 4208 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 4209 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 4210 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 4211 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 4212 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 4213 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 4214 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 4215 | * @param CompareUnit: Compare unit to configure |
mbed_official | 237:f3da66175598 | 4216 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 4217 | * @arg HRTIM_COMPAREUNIT_1: Compare unit 1 |
mbed_official | 237:f3da66175598 | 4218 | * @arg HRTIM_COMPAREUNIT_2: Compare unit 2 |
mbed_official | 237:f3da66175598 | 4219 | * @arg HRTIM_COMPAREUNIT_3: Compare unit 3 |
mbed_official | 237:f3da66175598 | 4220 | * @arg HRTIM_COMPAREUNIT_4: Compare unit 4 |
mbed_official | 237:f3da66175598 | 4221 | * @param pCompareCfg: pointer to the compare unit configuration structure |
mbed_official | 237:f3da66175598 | 4222 | * @note When auto delayed mode is required for compare unit 2 or compare unit 4, |
mbed_official | 237:f3da66175598 | 4223 | * application has to configure separately the capture unit. Capture unit |
mbed_official | 237:f3da66175598 | 4224 | * to configure in that case depends on the compare unit auto delayed mode |
mbed_official | 237:f3da66175598 | 4225 | * is applied to (see below): |
mbed_official | 237:f3da66175598 | 4226 | * Auto delayed on output compare 2: capture unit 1 must be configured |
mbed_official | 237:f3da66175598 | 4227 | * Auto delayed on output compare 4: capture unit 2 must be configured |
mbed_official | 237:f3da66175598 | 4228 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 4229 | * @note This function must be called before starting the timer |
mbed_official | 237:f3da66175598 | 4230 | */ |
mbed_official | 237:f3da66175598 | 4231 | HAL_StatusTypeDef HAL_HRTIM_WaveformCompareConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 4232 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 4233 | uint32_t CompareUnit, |
mbed_official | 237:f3da66175598 | 4234 | HRTIM_CompareCfgTypeDef* pCompareCfg) |
mbed_official | 237:f3da66175598 | 4235 | { |
mbed_official | 237:f3da66175598 | 4236 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 4237 | assert_param(IS_HRTIM_TIMERINDEX(TimerIdx)); |
mbed_official | 237:f3da66175598 | 4238 | |
mbed_official | 237:f3da66175598 | 4239 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 4240 | { |
mbed_official | 237:f3da66175598 | 4241 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 4242 | } |
mbed_official | 237:f3da66175598 | 4243 | |
mbed_official | 237:f3da66175598 | 4244 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 4245 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4246 | |
mbed_official | 237:f3da66175598 | 4247 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4248 | |
mbed_official | 237:f3da66175598 | 4249 | /* Configure the compare unit */ |
mbed_official | 237:f3da66175598 | 4250 | if (TimerIdx == HRTIM_TIMERINDEX_MASTER) |
mbed_official | 237:f3da66175598 | 4251 | { |
mbed_official | 237:f3da66175598 | 4252 | switch (CompareUnit) |
mbed_official | 237:f3da66175598 | 4253 | { |
mbed_official | 237:f3da66175598 | 4254 | case HRTIM_COMPAREUNIT_1: |
mbed_official | 237:f3da66175598 | 4255 | { |
mbed_official | 237:f3da66175598 | 4256 | hhrtim->Instance->sMasterRegs.MCMP1R = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 4257 | } |
mbed_official | 237:f3da66175598 | 4258 | break; |
mbed_official | 237:f3da66175598 | 4259 | case HRTIM_COMPAREUNIT_2: |
mbed_official | 237:f3da66175598 | 4260 | { |
mbed_official | 237:f3da66175598 | 4261 | hhrtim->Instance->sMasterRegs.MCMP2R = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 4262 | } |
mbed_official | 237:f3da66175598 | 4263 | break; |
mbed_official | 237:f3da66175598 | 4264 | case HRTIM_COMPAREUNIT_3: |
mbed_official | 237:f3da66175598 | 4265 | { |
mbed_official | 237:f3da66175598 | 4266 | hhrtim->Instance->sMasterRegs.MCMP3R = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 4267 | } |
mbed_official | 237:f3da66175598 | 4268 | break; |
mbed_official | 237:f3da66175598 | 4269 | case HRTIM_COMPAREUNIT_4: |
mbed_official | 237:f3da66175598 | 4270 | { |
mbed_official | 237:f3da66175598 | 4271 | hhrtim->Instance->sMasterRegs.MCMP4R = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 4272 | } |
mbed_official | 237:f3da66175598 | 4273 | break; |
mbed_official | 237:f3da66175598 | 4274 | } |
mbed_official | 237:f3da66175598 | 4275 | } |
mbed_official | 237:f3da66175598 | 4276 | else |
mbed_official | 237:f3da66175598 | 4277 | { |
mbed_official | 237:f3da66175598 | 4278 | switch (CompareUnit) |
mbed_official | 237:f3da66175598 | 4279 | { |
mbed_official | 237:f3da66175598 | 4280 | case HRTIM_COMPAREUNIT_1: |
mbed_official | 237:f3da66175598 | 4281 | { |
mbed_official | 237:f3da66175598 | 4282 | /* Set the compare value */ |
mbed_official | 237:f3da66175598 | 4283 | hhrtim->Instance->sTimerxRegs[TimerIdx].CMP1xR = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 4284 | } |
mbed_official | 237:f3da66175598 | 4285 | break; |
mbed_official | 237:f3da66175598 | 4286 | case HRTIM_COMPAREUNIT_2: |
mbed_official | 237:f3da66175598 | 4287 | { |
mbed_official | 237:f3da66175598 | 4288 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 4289 | assert_param(IS_HRTIM_COMPAREUNIT_AUTODELAYEDMODE(CompareUnit, pCompareCfg->AutoDelayedMode)); |
mbed_official | 237:f3da66175598 | 4290 | |
mbed_official | 237:f3da66175598 | 4291 | /* Set the compare value */ |
mbed_official | 237:f3da66175598 | 4292 | hhrtim->Instance->sTimerxRegs[TimerIdx].CMP2xR = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 4293 | |
mbed_official | 237:f3da66175598 | 4294 | if (pCompareCfg->AutoDelayedMode != HRTIM_AUTODELAYEDMODE_REGULAR) |
mbed_official | 237:f3da66175598 | 4295 | { |
mbed_official | 237:f3da66175598 | 4296 | /* Configure auto-delayed mode */ |
mbed_official | 237:f3da66175598 | 4297 | /* DELCMP2 bitfield must be reset when reprogrammed from one value */ |
mbed_official | 237:f3da66175598 | 4298 | /* to the other to reinitialize properly the auto-delayed mechanism */ |
mbed_official | 237:f3da66175598 | 4299 | hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxCR &= ~HRTIM_TIMCR_DELCMP2; |
mbed_official | 237:f3da66175598 | 4300 | hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxCR |= pCompareCfg->AutoDelayedMode; |
mbed_official | 237:f3da66175598 | 4301 | |
mbed_official | 237:f3da66175598 | 4302 | /* Set the compare value for timeout compare unit (if any) */ |
mbed_official | 237:f3da66175598 | 4303 | if (pCompareCfg->AutoDelayedMode == HRTIM_AUTODELAYEDMODE_AUTODELAYED_TIMEOUTCMP1) |
mbed_official | 237:f3da66175598 | 4304 | { |
mbed_official | 237:f3da66175598 | 4305 | hhrtim->Instance->sTimerxRegs[TimerIdx].CMP1xR = pCompareCfg->AutoDelayedTimeout; |
mbed_official | 237:f3da66175598 | 4306 | } |
mbed_official | 237:f3da66175598 | 4307 | else if (pCompareCfg->AutoDelayedMode == HRTIM_AUTODELAYEDMODE_AUTODELAYED_TIMEOUTCMP3) |
mbed_official | 237:f3da66175598 | 4308 | { |
mbed_official | 237:f3da66175598 | 4309 | hhrtim->Instance->sTimerxRegs[TimerIdx].CMP3xR = pCompareCfg->AutoDelayedTimeout; |
mbed_official | 237:f3da66175598 | 4310 | } |
mbed_official | 237:f3da66175598 | 4311 | } |
mbed_official | 237:f3da66175598 | 4312 | } |
mbed_official | 237:f3da66175598 | 4313 | break; |
mbed_official | 237:f3da66175598 | 4314 | case HRTIM_COMPAREUNIT_3: |
mbed_official | 237:f3da66175598 | 4315 | { |
mbed_official | 237:f3da66175598 | 4316 | /* Set the compare value */ |
mbed_official | 237:f3da66175598 | 4317 | hhrtim->Instance->sTimerxRegs[TimerIdx].CMP3xR = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 4318 | } |
mbed_official | 237:f3da66175598 | 4319 | break; |
mbed_official | 237:f3da66175598 | 4320 | case HRTIM_COMPAREUNIT_4: |
mbed_official | 237:f3da66175598 | 4321 | { |
mbed_official | 237:f3da66175598 | 4322 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 4323 | assert_param(IS_HRTIM_COMPAREUNIT_AUTODELAYEDMODE(CompareUnit, pCompareCfg->AutoDelayedMode)); |
mbed_official | 237:f3da66175598 | 4324 | |
mbed_official | 237:f3da66175598 | 4325 | /* Set the compare value */ |
mbed_official | 237:f3da66175598 | 4326 | hhrtim->Instance->sTimerxRegs[TimerIdx].CMP4xR = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 4327 | |
mbed_official | 237:f3da66175598 | 4328 | if (pCompareCfg->AutoDelayedMode != HRTIM_AUTODELAYEDMODE_REGULAR) |
mbed_official | 237:f3da66175598 | 4329 | { |
mbed_official | 237:f3da66175598 | 4330 | /* Configure auto-delayed mode */ |
mbed_official | 237:f3da66175598 | 4331 | /* DELCMP4 bitfield must be reset when reprogrammed from one value */ |
mbed_official | 237:f3da66175598 | 4332 | /* to the other to reinitialize properly the auto-delayed mechanism */ |
mbed_official | 237:f3da66175598 | 4333 | hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxCR &= ~HRTIM_TIMCR_DELCMP4; |
mbed_official | 237:f3da66175598 | 4334 | hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxCR |= (pCompareCfg->AutoDelayedMode << 2); |
mbed_official | 237:f3da66175598 | 4335 | |
mbed_official | 237:f3da66175598 | 4336 | /* Set the compare value for timeout compare unit (if any) */ |
mbed_official | 237:f3da66175598 | 4337 | if (pCompareCfg->AutoDelayedMode == HRTIM_AUTODELAYEDMODE_AUTODELAYED_TIMEOUTCMP1) |
mbed_official | 237:f3da66175598 | 4338 | { |
mbed_official | 237:f3da66175598 | 4339 | hhrtim->Instance->sTimerxRegs[TimerIdx].CMP1xR = pCompareCfg->AutoDelayedTimeout; |
mbed_official | 237:f3da66175598 | 4340 | } |
mbed_official | 237:f3da66175598 | 4341 | else if (pCompareCfg->AutoDelayedMode == HRTIM_AUTODELAYEDMODE_AUTODELAYED_TIMEOUTCMP3) |
mbed_official | 237:f3da66175598 | 4342 | { |
mbed_official | 237:f3da66175598 | 4343 | hhrtim->Instance->sTimerxRegs[TimerIdx].CMP3xR = pCompareCfg->AutoDelayedTimeout; |
mbed_official | 237:f3da66175598 | 4344 | } |
mbed_official | 237:f3da66175598 | 4345 | } |
mbed_official | 237:f3da66175598 | 4346 | } |
mbed_official | 237:f3da66175598 | 4347 | break; |
mbed_official | 237:f3da66175598 | 4348 | } |
mbed_official | 237:f3da66175598 | 4349 | } |
mbed_official | 237:f3da66175598 | 4350 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 4351 | |
mbed_official | 237:f3da66175598 | 4352 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 4353 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4354 | |
mbed_official | 237:f3da66175598 | 4355 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 4356 | } |
mbed_official | 237:f3da66175598 | 4357 | |
mbed_official | 237:f3da66175598 | 4358 | /** |
mbed_official | 237:f3da66175598 | 4359 | * @brief Configures the cature unit of a timer operating in waveform mode |
mbed_official | 237:f3da66175598 | 4360 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 4361 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 4362 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 4363 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 4364 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 4365 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 4366 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 4367 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 4368 | * @param CaptureUnit: Capture unit to configure |
mbed_official | 237:f3da66175598 | 4369 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 4370 | * @arg HRTIM_CAPTUREUNIT_1: Capture unit 1 |
mbed_official | 237:f3da66175598 | 4371 | * @arg HRTIM_CAPTUREUNIT_2: Capture unit 2 |
mbed_official | 237:f3da66175598 | 4372 | * @param pCaptureCfg: pointer to the compare unit configuration structure |
mbed_official | 237:f3da66175598 | 4373 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 4374 | * @note This function must be called before starting the timer |
mbed_official | 237:f3da66175598 | 4375 | */ |
mbed_official | 237:f3da66175598 | 4376 | HAL_StatusTypeDef HAL_HRTIM_WaveformCaptureConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 4377 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 4378 | uint32_t CaptureUnit, |
mbed_official | 237:f3da66175598 | 4379 | HRTIM_CaptureCfgTypeDef* pCaptureCfg) |
mbed_official | 237:f3da66175598 | 4380 | { |
mbed_official | 237:f3da66175598 | 4381 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 4382 | assert_param(IS_HRTIM_TIMER_CAPTURETRIGGER(TimerIdx, pCaptureCfg->Trigger)); |
mbed_official | 237:f3da66175598 | 4383 | |
mbed_official | 237:f3da66175598 | 4384 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 4385 | { |
mbed_official | 237:f3da66175598 | 4386 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 4387 | } |
mbed_official | 237:f3da66175598 | 4388 | |
mbed_official | 237:f3da66175598 | 4389 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 4390 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4391 | |
mbed_official | 237:f3da66175598 | 4392 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4393 | |
mbed_official | 237:f3da66175598 | 4394 | /* Configure the capture unit */ |
mbed_official | 237:f3da66175598 | 4395 | switch (CaptureUnit) |
mbed_official | 237:f3da66175598 | 4396 | { |
mbed_official | 237:f3da66175598 | 4397 | case HRTIM_CAPTUREUNIT_1: |
mbed_official | 237:f3da66175598 | 4398 | { |
mbed_official | 237:f3da66175598 | 4399 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT1xCR = pCaptureCfg->Trigger; |
mbed_official | 237:f3da66175598 | 4400 | } |
mbed_official | 237:f3da66175598 | 4401 | break; |
mbed_official | 237:f3da66175598 | 4402 | case HRTIM_CAPTUREUNIT_2: |
mbed_official | 237:f3da66175598 | 4403 | { |
mbed_official | 237:f3da66175598 | 4404 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR = pCaptureCfg->Trigger; |
mbed_official | 237:f3da66175598 | 4405 | } |
mbed_official | 237:f3da66175598 | 4406 | break; |
mbed_official | 237:f3da66175598 | 4407 | } |
mbed_official | 237:f3da66175598 | 4408 | |
mbed_official | 237:f3da66175598 | 4409 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 4410 | |
mbed_official | 237:f3da66175598 | 4411 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 4412 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4413 | |
mbed_official | 237:f3da66175598 | 4414 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 4415 | } |
mbed_official | 237:f3da66175598 | 4416 | |
mbed_official | 237:f3da66175598 | 4417 | /** |
mbed_official | 237:f3da66175598 | 4418 | * @brief Configures the output of a timer operating in waveform mode |
mbed_official | 237:f3da66175598 | 4419 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 4420 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 4421 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 4422 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 4423 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 4424 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 4425 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 4426 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 4427 | * @param Output: Timer output |
mbed_official | 237:f3da66175598 | 4428 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 4429 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 4430 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 4431 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 4432 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 4433 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 4434 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 4435 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 4436 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 4437 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 4438 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 4439 | * @param pOutputCfg: pointer to the timer output configuration structure |
mbed_official | 237:f3da66175598 | 4440 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 4441 | * @note This function must be called before configuring the timer and after |
mbed_official | 237:f3da66175598 | 4442 | * configuring the deadtime insertion feature (if required). |
mbed_official | 237:f3da66175598 | 4443 | */ |
mbed_official | 237:f3da66175598 | 4444 | HAL_StatusTypeDef HAL_HRTIM_WaveformOutputConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 4445 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 4446 | uint32_t Output, |
mbed_official | 237:f3da66175598 | 4447 | HRTIM_OutputCfgTypeDef * pOutputCfg) |
mbed_official | 237:f3da66175598 | 4448 | { |
mbed_official | 237:f3da66175598 | 4449 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 4450 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, Output)); |
mbed_official | 237:f3da66175598 | 4451 | assert_param(IS_HRTIM_OUTPUTPOLARITY(pOutputCfg->Polarity)); |
mbed_official | 237:f3da66175598 | 4452 | assert_param(IS_HRTIM_OUTPUTIDLELEVEL(pOutputCfg->IdleLevel)); |
mbed_official | 237:f3da66175598 | 4453 | assert_param(IS_HRTIM_OUTPUTIDLEMODE(pOutputCfg->IdleMode)); |
mbed_official | 237:f3da66175598 | 4454 | assert_param(IS_HRTIM_OUTPUTFAULTLEVEL(pOutputCfg->FaultLevel)); |
mbed_official | 237:f3da66175598 | 4455 | assert_param(IS_HRTIM_OUTPUTCHOPPERMODE(pOutputCfg->ChopperModeEnable)); |
mbed_official | 237:f3da66175598 | 4456 | assert_param(IS_HRTIM_OUTPUTBURSTMODEENTRY(pOutputCfg->BurstModeEntryDelayed)); |
mbed_official | 237:f3da66175598 | 4457 | |
mbed_official | 237:f3da66175598 | 4458 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 4459 | { |
mbed_official | 237:f3da66175598 | 4460 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 4461 | } |
mbed_official | 237:f3da66175598 | 4462 | |
mbed_official | 237:f3da66175598 | 4463 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 4464 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4465 | |
mbed_official | 237:f3da66175598 | 4466 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4467 | |
mbed_official | 237:f3da66175598 | 4468 | /* Configure the timer output */ |
mbed_official | 237:f3da66175598 | 4469 | HRTIM_OutputConfig(hhrtim, |
mbed_official | 237:f3da66175598 | 4470 | TimerIdx, |
mbed_official | 237:f3da66175598 | 4471 | Output, |
mbed_official | 237:f3da66175598 | 4472 | pOutputCfg); |
mbed_official | 237:f3da66175598 | 4473 | |
mbed_official | 237:f3da66175598 | 4474 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 4475 | |
mbed_official | 237:f3da66175598 | 4476 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 4477 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4478 | |
mbed_official | 237:f3da66175598 | 4479 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 4480 | } |
mbed_official | 237:f3da66175598 | 4481 | |
mbed_official | 237:f3da66175598 | 4482 | /** |
mbed_official | 237:f3da66175598 | 4483 | * @brief Forces the timer output to its active or inactive state |
mbed_official | 237:f3da66175598 | 4484 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 4485 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 4486 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 4487 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 4488 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 4489 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 4490 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 4491 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 4492 | * @param Output: Timer output |
mbed_official | 237:f3da66175598 | 4493 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 4494 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 4495 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 4496 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 4497 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 4498 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 4499 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 4500 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 4501 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 4502 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 4503 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 4504 | * @param OutputLevel: indicates whether the output is forced to its active or inactive level |
mbed_official | 237:f3da66175598 | 4505 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 4506 | * @arg HRTIM_OUTPUTLEVEL_ACTIVE: output is forced to its active level |
mbed_official | 237:f3da66175598 | 4507 | * @arg HRTIM_OUTPUTLEVEL_INACTIVE: output is forced to its inactive level |
mbed_official | 237:f3da66175598 | 4508 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 4509 | * @note The 'software set/reset trigger' bit in the output set/reset registers |
mbed_official | 237:f3da66175598 | 4510 | * is automatically reset by hardware |
mbed_official | 237:f3da66175598 | 4511 | */ |
mbed_official | 237:f3da66175598 | 4512 | HAL_StatusTypeDef HAL_HRTIM_WaveformSetOutputLevel(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 4513 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 4514 | uint32_t Output, |
mbed_official | 237:f3da66175598 | 4515 | uint32_t OutputLevel) |
mbed_official | 237:f3da66175598 | 4516 | { |
mbed_official | 237:f3da66175598 | 4517 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 4518 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, Output)); |
mbed_official | 237:f3da66175598 | 4519 | assert_param(IS_HRTIM_OUTPUTLEVEL(OutputLevel)); |
mbed_official | 237:f3da66175598 | 4520 | |
mbed_official | 237:f3da66175598 | 4521 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 4522 | { |
mbed_official | 237:f3da66175598 | 4523 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 4524 | } |
mbed_official | 237:f3da66175598 | 4525 | |
mbed_official | 237:f3da66175598 | 4526 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 4527 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4528 | |
mbed_official | 237:f3da66175598 | 4529 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4530 | |
mbed_official | 237:f3da66175598 | 4531 | /* Force timer output level */ |
mbed_official | 237:f3da66175598 | 4532 | switch (Output) |
mbed_official | 237:f3da66175598 | 4533 | { |
mbed_official | 237:f3da66175598 | 4534 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 4535 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 4536 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 4537 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 4538 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 4539 | { |
mbed_official | 237:f3da66175598 | 4540 | if (OutputLevel == HRTIM_OUTPUTLEVEL_ACTIVE) |
mbed_official | 237:f3da66175598 | 4541 | { |
mbed_official | 237:f3da66175598 | 4542 | /* Force output to its active state */ |
mbed_official | 237:f3da66175598 | 4543 | hhrtim->Instance->sTimerxRegs[TimerIdx].SETx1R |= HRTIM_SET1R_SST; |
mbed_official | 237:f3da66175598 | 4544 | } |
mbed_official | 237:f3da66175598 | 4545 | else |
mbed_official | 237:f3da66175598 | 4546 | { |
mbed_official | 237:f3da66175598 | 4547 | /* Force output to its inactive state */ |
mbed_official | 237:f3da66175598 | 4548 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTx1R |= HRTIM_RST1R_SRT; |
mbed_official | 237:f3da66175598 | 4549 | } |
mbed_official | 237:f3da66175598 | 4550 | } |
mbed_official | 237:f3da66175598 | 4551 | break; |
mbed_official | 237:f3da66175598 | 4552 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 4553 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 4554 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 4555 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 4556 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 4557 | { |
mbed_official | 237:f3da66175598 | 4558 | if (OutputLevel == HRTIM_OUTPUTLEVEL_ACTIVE) |
mbed_official | 237:f3da66175598 | 4559 | { |
mbed_official | 237:f3da66175598 | 4560 | /* Force output to its active state */ |
mbed_official | 237:f3da66175598 | 4561 | hhrtim->Instance->sTimerxRegs[TimerIdx].SETx2R |= HRTIM_SET2R_SST; |
mbed_official | 237:f3da66175598 | 4562 | } |
mbed_official | 237:f3da66175598 | 4563 | else |
mbed_official | 237:f3da66175598 | 4564 | { |
mbed_official | 237:f3da66175598 | 4565 | /* Force output to its inactive state */ |
mbed_official | 237:f3da66175598 | 4566 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTx2R |= HRTIM_RST2R_SRT; |
mbed_official | 237:f3da66175598 | 4567 | } |
mbed_official | 237:f3da66175598 | 4568 | } |
mbed_official | 237:f3da66175598 | 4569 | break; |
mbed_official | 237:f3da66175598 | 4570 | } |
mbed_official | 237:f3da66175598 | 4571 | |
mbed_official | 237:f3da66175598 | 4572 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 4573 | |
mbed_official | 237:f3da66175598 | 4574 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 4575 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4576 | |
mbed_official | 237:f3da66175598 | 4577 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 4578 | } |
mbed_official | 237:f3da66175598 | 4579 | |
mbed_official | 237:f3da66175598 | 4580 | /** |
mbed_official | 237:f3da66175598 | 4581 | * @brief Enables the generation of the waveform signal on the designated output(s) |
mbed_official | 237:f3da66175598 | 4582 | * Ouputs can becombined (ORed) to allow for simultaneous output enabling |
mbed_official | 237:f3da66175598 | 4583 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 4584 | * @param OutputsToStart: Timer output(s) to enable |
mbed_official | 237:f3da66175598 | 4585 | * This parameter can be any combination of the following values: |
mbed_official | 237:f3da66175598 | 4586 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 4587 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 4588 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 4589 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 4590 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 4591 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 4592 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 4593 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 4594 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 4595 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 4596 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 4597 | */ |
mbed_official | 237:f3da66175598 | 4598 | HAL_StatusTypeDef HAL_HRTIM_WaveformOutputStart(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 4599 | uint32_t OutputsToStart) |
mbed_official | 237:f3da66175598 | 4600 | { |
mbed_official | 237:f3da66175598 | 4601 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 4602 | assert_param(IS_HRTIM_OUTPUT(OutputsToStart)); |
mbed_official | 237:f3da66175598 | 4603 | |
mbed_official | 237:f3da66175598 | 4604 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 4605 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4606 | |
mbed_official | 237:f3da66175598 | 4607 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4608 | |
mbed_official | 237:f3da66175598 | 4609 | /* Enable the HRTIM outputs */ |
mbed_official | 237:f3da66175598 | 4610 | hhrtim->Instance->sCommonRegs.OENR |= (OutputsToStart); |
mbed_official | 237:f3da66175598 | 4611 | |
mbed_official | 237:f3da66175598 | 4612 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 4613 | |
mbed_official | 237:f3da66175598 | 4614 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 4615 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4616 | |
mbed_official | 237:f3da66175598 | 4617 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 4618 | } |
mbed_official | 237:f3da66175598 | 4619 | |
mbed_official | 237:f3da66175598 | 4620 | /** |
mbed_official | 237:f3da66175598 | 4621 | * @brief Disables the generation of the waveform signal on the designated output(s) |
mbed_official | 237:f3da66175598 | 4622 | * Ouputs can becombined (ORed) to allow for simultaneous output disabling |
mbed_official | 237:f3da66175598 | 4623 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 4624 | * @param OutputsToStop: Timer output(s) to disable |
mbed_official | 237:f3da66175598 | 4625 | * This parameter can be any combination of the following values: |
mbed_official | 237:f3da66175598 | 4626 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 4627 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 4628 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 4629 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 4630 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 4631 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 4632 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 4633 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 4634 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 4635 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 4636 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 4637 | */ |
mbed_official | 237:f3da66175598 | 4638 | HAL_StatusTypeDef HAL_HRTIM_WaveformOutputStop(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 4639 | uint32_t OutputsToStop) |
mbed_official | 237:f3da66175598 | 4640 | { |
mbed_official | 237:f3da66175598 | 4641 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 4642 | assert_param(IS_HRTIM_OUTPUT(OutputsToStop)); |
mbed_official | 237:f3da66175598 | 4643 | |
mbed_official | 237:f3da66175598 | 4644 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 4645 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4646 | |
mbed_official | 237:f3da66175598 | 4647 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4648 | |
mbed_official | 237:f3da66175598 | 4649 | /* Enable the HRTIM outputs */ |
mbed_official | 237:f3da66175598 | 4650 | hhrtim->Instance->sCommonRegs.ODISR |= (OutputsToStop); |
mbed_official | 237:f3da66175598 | 4651 | |
mbed_official | 237:f3da66175598 | 4652 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 4653 | |
mbed_official | 237:f3da66175598 | 4654 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 4655 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4656 | |
mbed_official | 237:f3da66175598 | 4657 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 4658 | } |
mbed_official | 237:f3da66175598 | 4659 | |
mbed_official | 237:f3da66175598 | 4660 | /** |
mbed_official | 237:f3da66175598 | 4661 | * @brief Starts the counter of the designated timer(s) operating in waveform mode |
mbed_official | 237:f3da66175598 | 4662 | * Timers can be combined (ORed) to allow for simultaneous counter start |
mbed_official | 237:f3da66175598 | 4663 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 4664 | * @param Timers: Timer counter(s) to start |
mbed_official | 237:f3da66175598 | 4665 | * This parameter can be any combination of the following values: |
mbed_official | 237:f3da66175598 | 4666 | * @arg HRTIM_TIMERID_MASTER |
mbed_official | 237:f3da66175598 | 4667 | * @arg HRTIM_TIMERID_TIMER_A |
mbed_official | 237:f3da66175598 | 4668 | * @arg HRTIM_TIMERID_TIMER_B |
mbed_official | 237:f3da66175598 | 4669 | * @arg HRTIM_TIMERID_TIMER_C |
mbed_official | 237:f3da66175598 | 4670 | * @arg HRTIM_TIMERID_TIMER_D |
mbed_official | 237:f3da66175598 | 4671 | * @arg HRTIM_TIMERID_TIMER_E |
mbed_official | 237:f3da66175598 | 4672 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 4673 | */ |
mbed_official | 237:f3da66175598 | 4674 | HAL_StatusTypeDef HAL_HRTIM_WaveformCounterStart(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 4675 | uint32_t Timers) |
mbed_official | 237:f3da66175598 | 4676 | { |
mbed_official | 237:f3da66175598 | 4677 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 4678 | assert_param(IS_HRTIM_TIMERID(Timers)); |
mbed_official | 237:f3da66175598 | 4679 | |
mbed_official | 237:f3da66175598 | 4680 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 4681 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4682 | |
mbed_official | 237:f3da66175598 | 4683 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4684 | |
mbed_official | 237:f3da66175598 | 4685 | /* Enable timer(s) counter */ |
mbed_official | 237:f3da66175598 | 4686 | hhrtim->Instance->sMasterRegs.MCR |= (Timers); |
mbed_official | 237:f3da66175598 | 4687 | |
mbed_official | 237:f3da66175598 | 4688 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 4689 | |
mbed_official | 237:f3da66175598 | 4690 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 4691 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4692 | |
mbed_official | 237:f3da66175598 | 4693 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 4694 | } |
mbed_official | 237:f3da66175598 | 4695 | |
mbed_official | 237:f3da66175598 | 4696 | /** |
mbed_official | 237:f3da66175598 | 4697 | * @brief Stops the counter of the designated timer(s) operating in waveform mode |
mbed_official | 237:f3da66175598 | 4698 | * Timers can be combined (ORed) to allow for simultaneous counter stop |
mbed_official | 237:f3da66175598 | 4699 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 4700 | * @param Timers: Timer counter(s) to stop |
mbed_official | 237:f3da66175598 | 4701 | * This parameter can be any combination of the following values: |
mbed_official | 237:f3da66175598 | 4702 | * @arg HRTIM_TIMER_MASTER |
mbed_official | 237:f3da66175598 | 4703 | * @arg HRTIM_TIMER_A |
mbed_official | 237:f3da66175598 | 4704 | * @arg HRTIM_TIMER_B |
mbed_official | 237:f3da66175598 | 4705 | * @arg HRTIM_TIMER_C |
mbed_official | 237:f3da66175598 | 4706 | * @arg HRTIM_TIMER_D |
mbed_official | 237:f3da66175598 | 4707 | * @arg HRTIM_TIMER_E |
mbed_official | 237:f3da66175598 | 4708 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 4709 | * @note The counter of a timer is stopped only if all timer outputs are disabled |
mbed_official | 237:f3da66175598 | 4710 | */ |
mbed_official | 237:f3da66175598 | 4711 | HAL_StatusTypeDef HAL_HRTIM_WaveformCounterStop(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 4712 | uint32_t Timers) |
mbed_official | 237:f3da66175598 | 4713 | { |
mbed_official | 237:f3da66175598 | 4714 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 4715 | assert_param(IS_HRTIM_TIMERID(Timers)); |
mbed_official | 237:f3da66175598 | 4716 | |
mbed_official | 237:f3da66175598 | 4717 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 4718 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4719 | |
mbed_official | 237:f3da66175598 | 4720 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4721 | |
mbed_official | 237:f3da66175598 | 4722 | /* Disable timer(s) counter */ |
mbed_official | 237:f3da66175598 | 4723 | hhrtim->Instance->sMasterRegs.MCR &= ~(Timers); |
mbed_official | 237:f3da66175598 | 4724 | |
mbed_official | 237:f3da66175598 | 4725 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 4726 | |
mbed_official | 237:f3da66175598 | 4727 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 4728 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4729 | |
mbed_official | 237:f3da66175598 | 4730 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 4731 | } |
mbed_official | 237:f3da66175598 | 4732 | |
mbed_official | 237:f3da66175598 | 4733 | /** |
mbed_official | 237:f3da66175598 | 4734 | * @brief Starts the counter of the designated timer(s) operating in waveform mode |
mbed_official | 237:f3da66175598 | 4735 | * Timers can be combined (ORed) to allow for simultaneous counter start |
mbed_official | 237:f3da66175598 | 4736 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 4737 | * @param Timers: Timer counter(s) to start |
mbed_official | 237:f3da66175598 | 4738 | * This parameter can be any combination of the following values: |
mbed_official | 237:f3da66175598 | 4739 | * @arg HRTIM_TIMERID_MASTER |
mbed_official | 237:f3da66175598 | 4740 | * @arg HRTIM_TIMERID_A |
mbed_official | 237:f3da66175598 | 4741 | * @arg HRTIM_TIMERID_B |
mbed_official | 237:f3da66175598 | 4742 | * @arg HRTIM_TIMERID_C |
mbed_official | 237:f3da66175598 | 4743 | * @arg HRTIM_TIMERID_D |
mbed_official | 237:f3da66175598 | 4744 | * @arg HRTIM_TIMERID_E |
mbed_official | 237:f3da66175598 | 4745 | * @note HRTIM interrupts (e.g. faults interrupts) and interrupts related |
mbed_official | 237:f3da66175598 | 4746 | * to the timers to start are enabled within this function. |
mbed_official | 237:f3da66175598 | 4747 | * Interrupts to enable are selected through HAL_HRTIM_WaveformTimerConfig |
mbed_official | 237:f3da66175598 | 4748 | * function. |
mbed_official | 237:f3da66175598 | 4749 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 4750 | */ |
mbed_official | 237:f3da66175598 | 4751 | HAL_StatusTypeDef HAL_HRTIM_WaveformCounterStart_IT(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 4752 | uint32_t Timers) |
mbed_official | 237:f3da66175598 | 4753 | { |
mbed_official | 237:f3da66175598 | 4754 | uint8_t timer_idx; |
mbed_official | 237:f3da66175598 | 4755 | |
mbed_official | 237:f3da66175598 | 4756 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 4757 | assert_param(IS_HRTIM_TIMERID(Timers)); |
mbed_official | 237:f3da66175598 | 4758 | |
mbed_official | 237:f3da66175598 | 4759 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 4760 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4761 | |
mbed_official | 237:f3da66175598 | 4762 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4763 | |
mbed_official | 237:f3da66175598 | 4764 | /* Enable HRTIM interrupts (if required) */ |
mbed_official | 237:f3da66175598 | 4765 | __HAL_HRTIM_ENABLE_IT(hhrtim, hhrtim->Init.HRTIMInterruptResquests); |
mbed_official | 237:f3da66175598 | 4766 | |
mbed_official | 237:f3da66175598 | 4767 | /* Enable master timer related interrupts (if required) */ |
mbed_official | 237:f3da66175598 | 4768 | if ((Timers & HRTIM_TIMERID_MASTER) != RESET) |
mbed_official | 237:f3da66175598 | 4769 | { |
mbed_official | 237:f3da66175598 | 4770 | __HAL_HRTIM_MASTER_ENABLE_IT(hhrtim, |
mbed_official | 237:f3da66175598 | 4771 | hhrtim->TimerParam[HRTIM_TIMERINDEX_MASTER].InterruptRequests); |
mbed_official | 237:f3da66175598 | 4772 | } |
mbed_official | 237:f3da66175598 | 4773 | |
mbed_official | 237:f3da66175598 | 4774 | /* Enable timing unit related interrupts (if required) */ |
mbed_official | 237:f3da66175598 | 4775 | for (timer_idx = HRTIM_TIMERINDEX_TIMER_A ; |
mbed_official | 237:f3da66175598 | 4776 | timer_idx < HRTIM_TIMERINDEX_MASTER ; |
mbed_official | 237:f3da66175598 | 4777 | timer_idx++) |
mbed_official | 237:f3da66175598 | 4778 | { |
mbed_official | 237:f3da66175598 | 4779 | if ((Timers & TimerIdxToTimerId[timer_idx]) != RESET) |
mbed_official | 237:f3da66175598 | 4780 | { |
mbed_official | 237:f3da66175598 | 4781 | __HAL_HRTIM_TIMER_ENABLE_IT(hhrtim, |
mbed_official | 237:f3da66175598 | 4782 | timer_idx, |
mbed_official | 237:f3da66175598 | 4783 | hhrtim->TimerParam[timer_idx].InterruptRequests); |
mbed_official | 237:f3da66175598 | 4784 | } |
mbed_official | 237:f3da66175598 | 4785 | } |
mbed_official | 237:f3da66175598 | 4786 | |
mbed_official | 237:f3da66175598 | 4787 | /* Enable timer(s) counter */ |
mbed_official | 237:f3da66175598 | 4788 | hhrtim->Instance->sMasterRegs.MCR |= (Timers); |
mbed_official | 237:f3da66175598 | 4789 | |
mbed_official | 237:f3da66175598 | 4790 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 4791 | |
mbed_official | 237:f3da66175598 | 4792 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 4793 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4794 | |
mbed_official | 237:f3da66175598 | 4795 | return HAL_OK;} |
mbed_official | 237:f3da66175598 | 4796 | |
mbed_official | 237:f3da66175598 | 4797 | /** |
mbed_official | 237:f3da66175598 | 4798 | * @brief Stops the counter of the designated timer(s) operating in waveform mode |
mbed_official | 237:f3da66175598 | 4799 | * Timers can be combined (ORed) to allow for simultaneous counter stop |
mbed_official | 237:f3da66175598 | 4800 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 4801 | * @param Timers: Timer counter(s) to stop |
mbed_official | 237:f3da66175598 | 4802 | * This parameter can be any combination of the following values: |
mbed_official | 237:f3da66175598 | 4803 | * @arg HRTIM_TIMER_MASTER |
mbed_official | 237:f3da66175598 | 4804 | * @arg HRTIM_TIMER_A |
mbed_official | 237:f3da66175598 | 4805 | * @arg HRTIM_TIMER_B |
mbed_official | 237:f3da66175598 | 4806 | * @arg HRTIM_TIMER_C |
mbed_official | 237:f3da66175598 | 4807 | * @arg HRTIM_TIMER_D |
mbed_official | 237:f3da66175598 | 4808 | * @arg HRTIM_TIMER_E |
mbed_official | 237:f3da66175598 | 4809 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 4810 | * @note The counter of a timer is stopped only if all timer outputs are disabled |
mbed_official | 237:f3da66175598 | 4811 | * @note All enabled timer related interrupts are disabled. |
mbed_official | 237:f3da66175598 | 4812 | */ |
mbed_official | 237:f3da66175598 | 4813 | HAL_StatusTypeDef HAL_HRTIM_WaveformCounterStop_IT(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 4814 | uint32_t Timers) |
mbed_official | 237:f3da66175598 | 4815 | { |
mbed_official | 237:f3da66175598 | 4816 | /* ++ WA */ |
mbed_official | 237:f3da66175598 | 4817 | __IO uint32_t delai = (uint32_t)(0x17F); |
mbed_official | 237:f3da66175598 | 4818 | /* -- WA */ |
mbed_official | 237:f3da66175598 | 4819 | |
mbed_official | 237:f3da66175598 | 4820 | uint8_t timer_idx; |
mbed_official | 237:f3da66175598 | 4821 | |
mbed_official | 237:f3da66175598 | 4822 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 4823 | assert_param(IS_HRTIM_TIMERID(Timers)); |
mbed_official | 237:f3da66175598 | 4824 | |
mbed_official | 237:f3da66175598 | 4825 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 4826 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4827 | |
mbed_official | 237:f3da66175598 | 4828 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4829 | |
mbed_official | 237:f3da66175598 | 4830 | /* Disable HRTIM interrupts (if required) */ |
mbed_official | 237:f3da66175598 | 4831 | __HAL_HRTIM_DISABLE_IT(hhrtim, hhrtim->Init.HRTIMInterruptResquests); |
mbed_official | 237:f3da66175598 | 4832 | |
mbed_official | 237:f3da66175598 | 4833 | /* Disable master timer related interrupts (if required) */ |
mbed_official | 237:f3da66175598 | 4834 | if ((Timers & HRTIM_TIMERID_MASTER) != RESET) |
mbed_official | 237:f3da66175598 | 4835 | { |
mbed_official | 237:f3da66175598 | 4836 | /* Interrupts enable flag must be cleared one by one */ |
mbed_official | 237:f3da66175598 | 4837 | __HAL_HRTIM_MASTER_DISABLE_IT(hhrtim, hhrtim->TimerParam[HRTIM_TIMERINDEX_MASTER].InterruptRequests); |
mbed_official | 237:f3da66175598 | 4838 | } |
mbed_official | 237:f3da66175598 | 4839 | |
mbed_official | 237:f3da66175598 | 4840 | /* Disable timing unit related interrupts (if required) */ |
mbed_official | 237:f3da66175598 | 4841 | for (timer_idx = HRTIM_TIMERINDEX_TIMER_A ; |
mbed_official | 237:f3da66175598 | 4842 | timer_idx < HRTIM_TIMERINDEX_MASTER ; |
mbed_official | 237:f3da66175598 | 4843 | timer_idx++) |
mbed_official | 237:f3da66175598 | 4844 | { |
mbed_official | 237:f3da66175598 | 4845 | if ((Timers & TimerIdxToTimerId[timer_idx]) != RESET) |
mbed_official | 237:f3da66175598 | 4846 | { |
mbed_official | 237:f3da66175598 | 4847 | __HAL_HRTIM_TIMER_DISABLE_IT(hhrtim, timer_idx, hhrtim->TimerParam[timer_idx].InterruptRequests); |
mbed_official | 237:f3da66175598 | 4848 | } |
mbed_official | 237:f3da66175598 | 4849 | } |
mbed_official | 237:f3da66175598 | 4850 | |
mbed_official | 237:f3da66175598 | 4851 | /* ++ WA */ |
mbed_official | 237:f3da66175598 | 4852 | do { delai--; } while (delai != 0); |
mbed_official | 237:f3da66175598 | 4853 | /* -- WA */ |
mbed_official | 237:f3da66175598 | 4854 | |
mbed_official | 237:f3da66175598 | 4855 | /* Disable timer(s) counter */ |
mbed_official | 237:f3da66175598 | 4856 | hhrtim->Instance->sMasterRegs.MCR &= ~(Timers); |
mbed_official | 237:f3da66175598 | 4857 | |
mbed_official | 237:f3da66175598 | 4858 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 4859 | |
mbed_official | 237:f3da66175598 | 4860 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 4861 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4862 | |
mbed_official | 237:f3da66175598 | 4863 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 4864 | } |
mbed_official | 237:f3da66175598 | 4865 | |
mbed_official | 237:f3da66175598 | 4866 | /** |
mbed_official | 237:f3da66175598 | 4867 | * @brief Starts the counter of the designated timer(s) operating in waveform mode |
mbed_official | 237:f3da66175598 | 4868 | * Timers can be combined (ORed) to allow for simultaneous counter start |
mbed_official | 237:f3da66175598 | 4869 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 4870 | * @param Timers: Timer counter(s) to start |
mbed_official | 237:f3da66175598 | 4871 | * This parameter can be any combination of the following values: |
mbed_official | 237:f3da66175598 | 4872 | * HRTIM_TIMER_MASTER |
mbed_official | 237:f3da66175598 | 4873 | * @arg HRTIM_TIMER_A |
mbed_official | 237:f3da66175598 | 4874 | * @arg HRTIM_TIMER_B |
mbed_official | 237:f3da66175598 | 4875 | * @arg HRTIM_TIMER_C |
mbed_official | 237:f3da66175598 | 4876 | * @arg HRTIM_TIMER_D |
mbed_official | 237:f3da66175598 | 4877 | * @arg HRTIM_TIMER_E |
mbed_official | 237:f3da66175598 | 4878 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 4879 | * @note This function enables the dma request(s) mentionned in the timer |
mbed_official | 237:f3da66175598 | 4880 | * configuration data structure for every timers to start. |
mbed_official | 237:f3da66175598 | 4881 | * @note The source memory address, the destination memory address and the |
mbed_official | 237:f3da66175598 | 4882 | * size of each DMA transfer are specified at timer configuration time |
mbed_official | 237:f3da66175598 | 4883 | * (see HAL_HRTIM_WaveformTimerConfig) |
mbed_official | 237:f3da66175598 | 4884 | */ |
mbed_official | 237:f3da66175598 | 4885 | HAL_StatusTypeDef HAL_HRTIM_WaveformCounterStart_DMA(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 4886 | uint32_t Timers) |
mbed_official | 237:f3da66175598 | 4887 | { |
mbed_official | 237:f3da66175598 | 4888 | uint8_t timer_idx; |
mbed_official | 237:f3da66175598 | 4889 | DMA_HandleTypeDef * hdma; |
mbed_official | 237:f3da66175598 | 4890 | |
mbed_official | 237:f3da66175598 | 4891 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 4892 | assert_param(IS_HRTIM_TIMERID(Timers)); |
mbed_official | 237:f3da66175598 | 4893 | |
mbed_official | 237:f3da66175598 | 4894 | if((hhrtim->State == HAL_HRTIM_STATE_BUSY)) |
mbed_official | 237:f3da66175598 | 4895 | { |
mbed_official | 237:f3da66175598 | 4896 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 4897 | } |
mbed_official | 237:f3da66175598 | 4898 | |
mbed_official | 237:f3da66175598 | 4899 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4900 | |
mbed_official | 237:f3da66175598 | 4901 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 4902 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4903 | |
mbed_official | 237:f3da66175598 | 4904 | if (((Timers & HRTIM_TIMERID_MASTER) != RESET) && |
mbed_official | 237:f3da66175598 | 4905 | (hhrtim->TimerParam[HRTIM_TIMERINDEX_MASTER].DMARequests != 0)) |
mbed_official | 237:f3da66175598 | 4906 | { |
mbed_official | 237:f3da66175598 | 4907 | /* Set the DMA error callback */ |
mbed_official | 237:f3da66175598 | 4908 | hhrtim->hdmaMaster->XferErrorCallback = HRTIM_DMAError ; |
mbed_official | 237:f3da66175598 | 4909 | |
mbed_official | 237:f3da66175598 | 4910 | /* Set the DMA transfer completed callback */ |
mbed_official | 237:f3da66175598 | 4911 | hhrtim->hdmaMaster->XferCpltCallback = HRTIM_DMAMasterCplt; |
mbed_official | 237:f3da66175598 | 4912 | |
mbed_official | 237:f3da66175598 | 4913 | /* Enable the DMA channel */ |
mbed_official | 237:f3da66175598 | 4914 | HAL_DMA_Start_IT(hhrtim->hdmaMaster, |
mbed_official | 237:f3da66175598 | 4915 | hhrtim->TimerParam[HRTIM_TIMERINDEX_MASTER].DMASrcAddress, |
mbed_official | 237:f3da66175598 | 4916 | hhrtim->TimerParam[HRTIM_TIMERINDEX_MASTER].DMADstAddress, |
mbed_official | 237:f3da66175598 | 4917 | hhrtim->TimerParam[HRTIM_TIMERINDEX_MASTER].DMASize); |
mbed_official | 237:f3da66175598 | 4918 | |
mbed_official | 237:f3da66175598 | 4919 | /* Enable the timer DMA request */ |
mbed_official | 237:f3da66175598 | 4920 | __HAL_HRTIM_MASTER_ENABLE_DMA(hhrtim, |
mbed_official | 237:f3da66175598 | 4921 | hhrtim->TimerParam[HRTIM_TIMERINDEX_MASTER].DMARequests); |
mbed_official | 237:f3da66175598 | 4922 | } |
mbed_official | 237:f3da66175598 | 4923 | |
mbed_official | 237:f3da66175598 | 4924 | for (timer_idx = HRTIM_TIMERINDEX_TIMER_A ; |
mbed_official | 237:f3da66175598 | 4925 | timer_idx < HRTIM_TIMERINDEX_MASTER ; |
mbed_official | 237:f3da66175598 | 4926 | timer_idx++) |
mbed_official | 237:f3da66175598 | 4927 | { |
mbed_official | 237:f3da66175598 | 4928 | if (((Timers & TimerIdxToTimerId[timer_idx]) != RESET) && |
mbed_official | 237:f3da66175598 | 4929 | (hhrtim->TimerParam[timer_idx].DMARequests != 0)) |
mbed_official | 237:f3da66175598 | 4930 | { |
mbed_official | 237:f3da66175598 | 4931 | /* Get the timer DMA handler */ |
mbed_official | 237:f3da66175598 | 4932 | hdma = HRTIM_GetDMAHandleFromTimerIdx(hhrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 4933 | |
mbed_official | 237:f3da66175598 | 4934 | /* Set the DMA error callback */ |
mbed_official | 237:f3da66175598 | 4935 | hdma->XferErrorCallback = HRTIM_DMAError ; |
mbed_official | 237:f3da66175598 | 4936 | |
mbed_official | 237:f3da66175598 | 4937 | /* Set the DMA transfer completed callback */ |
mbed_official | 237:f3da66175598 | 4938 | hdma->XferCpltCallback = HRTIM_DMATimerxCplt; |
mbed_official | 237:f3da66175598 | 4939 | |
mbed_official | 237:f3da66175598 | 4940 | /* Enable the DMA channel */ |
mbed_official | 237:f3da66175598 | 4941 | HAL_DMA_Start_IT(hdma, |
mbed_official | 237:f3da66175598 | 4942 | hhrtim->TimerParam[timer_idx].DMASrcAddress, |
mbed_official | 237:f3da66175598 | 4943 | hhrtim->TimerParam[timer_idx].DMADstAddress, |
mbed_official | 237:f3da66175598 | 4944 | hhrtim->TimerParam[timer_idx].DMASize); |
mbed_official | 237:f3da66175598 | 4945 | |
mbed_official | 237:f3da66175598 | 4946 | /* Enable the timer DMA request */ |
mbed_official | 237:f3da66175598 | 4947 | __HAL_HRTIM_TIMER_ENABLE_DMA(hhrtim, |
mbed_official | 237:f3da66175598 | 4948 | timer_idx, |
mbed_official | 237:f3da66175598 | 4949 | hhrtim->TimerParam[timer_idx].DMARequests); |
mbed_official | 237:f3da66175598 | 4950 | } |
mbed_official | 237:f3da66175598 | 4951 | } |
mbed_official | 237:f3da66175598 | 4952 | |
mbed_official | 237:f3da66175598 | 4953 | /* Enable the timer counter */ |
mbed_official | 237:f3da66175598 | 4954 | __HAL_HRTIM_ENABLE(hhrtim, Timers); |
mbed_official | 237:f3da66175598 | 4955 | |
mbed_official | 237:f3da66175598 | 4956 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 4957 | |
mbed_official | 237:f3da66175598 | 4958 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 4959 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 4960 | |
mbed_official | 237:f3da66175598 | 4961 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 4962 | } |
mbed_official | 237:f3da66175598 | 4963 | |
mbed_official | 237:f3da66175598 | 4964 | /** |
mbed_official | 237:f3da66175598 | 4965 | * @brief Stops the counter of the designated timer(s) operating in waveform mode |
mbed_official | 237:f3da66175598 | 4966 | * Timers can be combined (ORed) to allow for simultaneous counter stop |
mbed_official | 237:f3da66175598 | 4967 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 4968 | * @param Timers: Timer counter(s) to stop |
mbed_official | 237:f3da66175598 | 4969 | * This parameter can be any combination of the following values: |
mbed_official | 237:f3da66175598 | 4970 | * @arg HRTIM_TIMER_MASTER |
mbed_official | 237:f3da66175598 | 4971 | * @arg HRTIM_TIMER_A |
mbed_official | 237:f3da66175598 | 4972 | * @arg HRTIM_TIMER_B |
mbed_official | 237:f3da66175598 | 4973 | * @arg HRTIM_TIMER_C |
mbed_official | 237:f3da66175598 | 4974 | * @arg HRTIM_TIMER_D |
mbed_official | 237:f3da66175598 | 4975 | * @arg HRTIM_TIMER_E |
mbed_official | 237:f3da66175598 | 4976 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 4977 | * @note The counter of a timer is stopped only if all timer outputs are disabled |
mbed_official | 237:f3da66175598 | 4978 | * @note All enabled timer related DMA requests are disabled. |
mbed_official | 237:f3da66175598 | 4979 | */ |
mbed_official | 237:f3da66175598 | 4980 | HAL_StatusTypeDef HAL_HRTIM_WaveformCounterStop_DMA(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 4981 | uint32_t Timers) |
mbed_official | 237:f3da66175598 | 4982 | { |
mbed_official | 237:f3da66175598 | 4983 | uint8_t timer_idx; |
mbed_official | 237:f3da66175598 | 4984 | DMA_HandleTypeDef * hdma; |
mbed_official | 237:f3da66175598 | 4985 | |
mbed_official | 237:f3da66175598 | 4986 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 4987 | assert_param(IS_HRTIM_TIMERID(Timers)); |
mbed_official | 237:f3da66175598 | 4988 | |
mbed_official | 237:f3da66175598 | 4989 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 4990 | |
mbed_official | 237:f3da66175598 | 4991 | if (((Timers & HRTIM_TIMERID_MASTER) != RESET) && |
mbed_official | 237:f3da66175598 | 4992 | (hhrtim->TimerParam[HRTIM_TIMERINDEX_MASTER].DMARequests != 0)) |
mbed_official | 237:f3da66175598 | 4993 | { |
mbed_official | 237:f3da66175598 | 4994 | /* Disable the DMA */ |
mbed_official | 237:f3da66175598 | 4995 | HAL_DMA_Abort(hhrtim->hdmaMaster); |
mbed_official | 237:f3da66175598 | 4996 | |
mbed_official | 237:f3da66175598 | 4997 | /* Disable the DMA request(s) */ |
mbed_official | 237:f3da66175598 | 4998 | __HAL_HRTIM_MASTER_DISABLE_DMA(hhrtim, |
mbed_official | 237:f3da66175598 | 4999 | hhrtim->TimerParam[HRTIM_TIMERINDEX_MASTER].DMARequests); |
mbed_official | 237:f3da66175598 | 5000 | } |
mbed_official | 237:f3da66175598 | 5001 | |
mbed_official | 237:f3da66175598 | 5002 | for (timer_idx = HRTIM_TIMERINDEX_TIMER_A ; |
mbed_official | 237:f3da66175598 | 5003 | timer_idx < HRTIM_TIMERINDEX_MASTER ; |
mbed_official | 237:f3da66175598 | 5004 | timer_idx++) |
mbed_official | 237:f3da66175598 | 5005 | { |
mbed_official | 237:f3da66175598 | 5006 | if (((Timers & TimerIdxToTimerId[timer_idx]) != RESET) && |
mbed_official | 237:f3da66175598 | 5007 | (hhrtim->TimerParam[timer_idx].DMARequests != 0)) |
mbed_official | 237:f3da66175598 | 5008 | { |
mbed_official | 237:f3da66175598 | 5009 | /* Get the timer DMA handler */ |
mbed_official | 237:f3da66175598 | 5010 | hdma = HRTIM_GetDMAHandleFromTimerIdx(hhrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 5011 | |
mbed_official | 237:f3da66175598 | 5012 | /* Disable the DMA */ |
mbed_official | 237:f3da66175598 | 5013 | HAL_DMA_Abort(hdma); |
mbed_official | 237:f3da66175598 | 5014 | |
mbed_official | 237:f3da66175598 | 5015 | /* Disable the DMA request(s) */ |
mbed_official | 237:f3da66175598 | 5016 | __HAL_HRTIM_TIMER_DISABLE_DMA(hhrtim, |
mbed_official | 237:f3da66175598 | 5017 | timer_idx, |
mbed_official | 237:f3da66175598 | 5018 | hhrtim->TimerParam[timer_idx].DMARequests); |
mbed_official | 237:f3da66175598 | 5019 | } |
mbed_official | 237:f3da66175598 | 5020 | } |
mbed_official | 237:f3da66175598 | 5021 | |
mbed_official | 237:f3da66175598 | 5022 | /* Disable the timer counter */ |
mbed_official | 237:f3da66175598 | 5023 | __HAL_HRTIM_DISABLE(hhrtim, Timers); |
mbed_official | 237:f3da66175598 | 5024 | |
mbed_official | 237:f3da66175598 | 5025 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 5026 | |
mbed_official | 237:f3da66175598 | 5027 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 5028 | } |
mbed_official | 237:f3da66175598 | 5029 | |
mbed_official | 237:f3da66175598 | 5030 | /** |
mbed_official | 237:f3da66175598 | 5031 | * @brief Enables or disables the HRTIM burst mode controller. |
mbed_official | 237:f3da66175598 | 5032 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5033 | * @param Enable: Burst mode controller enabling |
mbed_official | 237:f3da66175598 | 5034 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 5035 | * @arg HRTIM_BURSTMODECTL_ENABLED: Burst mode enabled |
mbed_official | 237:f3da66175598 | 5036 | * @arg HRTIM_BURSTMODECTL_DISABLED: Burst mode disabled |
mbed_official | 237:f3da66175598 | 5037 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 5038 | * @note This function must be called after starting the timer(s) |
mbed_official | 237:f3da66175598 | 5039 | */ |
mbed_official | 237:f3da66175598 | 5040 | HAL_StatusTypeDef HAL_HRTIM_BurstModeCtl(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 5041 | uint32_t Enable) |
mbed_official | 237:f3da66175598 | 5042 | { |
mbed_official | 237:f3da66175598 | 5043 | uint32_t hrtim_bmcr; |
mbed_official | 237:f3da66175598 | 5044 | |
mbed_official | 237:f3da66175598 | 5045 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 5046 | assert_param(IS_HRTIM_BURSTMODECTL(Enable)); |
mbed_official | 237:f3da66175598 | 5047 | |
mbed_official | 237:f3da66175598 | 5048 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 5049 | { |
mbed_official | 237:f3da66175598 | 5050 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 5051 | } |
mbed_official | 237:f3da66175598 | 5052 | |
mbed_official | 237:f3da66175598 | 5053 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 5054 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5055 | |
mbed_official | 237:f3da66175598 | 5056 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 5057 | |
mbed_official | 237:f3da66175598 | 5058 | /* Enable/Disable the burst mode controller */ |
mbed_official | 237:f3da66175598 | 5059 | hrtim_bmcr = hhrtim->Instance->sCommonRegs.BMCR; |
mbed_official | 237:f3da66175598 | 5060 | hrtim_bmcr &= ~(HRTIM_BMCR_BME); |
mbed_official | 237:f3da66175598 | 5061 | hrtim_bmcr |= Enable; |
mbed_official | 237:f3da66175598 | 5062 | |
mbed_official | 237:f3da66175598 | 5063 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 5064 | hhrtim->Instance->sCommonRegs.BMCR = hrtim_bmcr; |
mbed_official | 237:f3da66175598 | 5065 | |
mbed_official | 237:f3da66175598 | 5066 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 5067 | |
mbed_official | 237:f3da66175598 | 5068 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 5069 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5070 | |
mbed_official | 237:f3da66175598 | 5071 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 5072 | } |
mbed_official | 237:f3da66175598 | 5073 | |
mbed_official | 237:f3da66175598 | 5074 | /** |
mbed_official | 237:f3da66175598 | 5075 | * @brief Triggers the burst mode operation. |
mbed_official | 237:f3da66175598 | 5076 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5077 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 5078 | */ |
mbed_official | 237:f3da66175598 | 5079 | HAL_StatusTypeDef HAL_HRTIM_BurstModeSoftwareTrigger(HRTIM_HandleTypeDef *hhrtim) |
mbed_official | 237:f3da66175598 | 5080 | { |
mbed_official | 237:f3da66175598 | 5081 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 5082 | { |
mbed_official | 237:f3da66175598 | 5083 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 5084 | } |
mbed_official | 237:f3da66175598 | 5085 | |
mbed_official | 237:f3da66175598 | 5086 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 5087 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5088 | |
mbed_official | 237:f3da66175598 | 5089 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 5090 | |
mbed_official | 237:f3da66175598 | 5091 | /* Software trigger of the burst mode controller */ |
mbed_official | 237:f3da66175598 | 5092 | hhrtim->Instance->sCommonRegs.BMTRGR |= HRTIM_BMTRGR_SW; |
mbed_official | 237:f3da66175598 | 5093 | |
mbed_official | 237:f3da66175598 | 5094 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 5095 | |
mbed_official | 237:f3da66175598 | 5096 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 5097 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5098 | |
mbed_official | 237:f3da66175598 | 5099 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 5100 | } |
mbed_official | 237:f3da66175598 | 5101 | |
mbed_official | 237:f3da66175598 | 5102 | /** |
mbed_official | 237:f3da66175598 | 5103 | * @brief Triggers a software capture on the designed capture unit |
mbed_official | 237:f3da66175598 | 5104 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5105 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 5106 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 5107 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 5108 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 5109 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 5110 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 5111 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 5112 | * @param CaptureUnit: Capture unit to trig |
mbed_official | 237:f3da66175598 | 5113 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 5114 | * @arg HRTIM_CAPTUREUNIT_1: Capture unit 1 |
mbed_official | 237:f3da66175598 | 5115 | * @arg HRTIM_CAPTUREUNIT_2: Capture unit 2 |
mbed_official | 237:f3da66175598 | 5116 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 5117 | * @note The 'software capture' bit in the capure configuration register is |
mbed_official | 237:f3da66175598 | 5118 | * automatically reset by hardware |
mbed_official | 237:f3da66175598 | 5119 | */ |
mbed_official | 237:f3da66175598 | 5120 | HAL_StatusTypeDef HAL_HRTIM_SoftwareCapture(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 5121 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 5122 | uint32_t CaptureUnit) |
mbed_official | 237:f3da66175598 | 5123 | { |
mbed_official | 237:f3da66175598 | 5124 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 5125 | assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); |
mbed_official | 237:f3da66175598 | 5126 | assert_param(IS_HRTIM_CAPTUREUNIT(CaptureUnit)); |
mbed_official | 237:f3da66175598 | 5127 | |
mbed_official | 237:f3da66175598 | 5128 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 5129 | { |
mbed_official | 237:f3da66175598 | 5130 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 5131 | } |
mbed_official | 237:f3da66175598 | 5132 | |
mbed_official | 237:f3da66175598 | 5133 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 5134 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5135 | |
mbed_official | 237:f3da66175598 | 5136 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 5137 | |
mbed_official | 237:f3da66175598 | 5138 | /* Force a software capture on concerned capture unit */ |
mbed_official | 237:f3da66175598 | 5139 | switch (CaptureUnit) |
mbed_official | 237:f3da66175598 | 5140 | { |
mbed_official | 237:f3da66175598 | 5141 | case HRTIM_CAPTUREUNIT_1: |
mbed_official | 237:f3da66175598 | 5142 | { |
mbed_official | 237:f3da66175598 | 5143 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT1xCR |= HRTIM_CPT1CR_SWCPT; |
mbed_official | 237:f3da66175598 | 5144 | } |
mbed_official | 237:f3da66175598 | 5145 | break; |
mbed_official | 237:f3da66175598 | 5146 | case HRTIM_CAPTUREUNIT_2: |
mbed_official | 237:f3da66175598 | 5147 | { |
mbed_official | 237:f3da66175598 | 5148 | hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xCR |= HRTIM_CPT2CR_SWCPT; |
mbed_official | 237:f3da66175598 | 5149 | } |
mbed_official | 237:f3da66175598 | 5150 | break; |
mbed_official | 237:f3da66175598 | 5151 | } |
mbed_official | 237:f3da66175598 | 5152 | |
mbed_official | 237:f3da66175598 | 5153 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 5154 | |
mbed_official | 237:f3da66175598 | 5155 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 5156 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5157 | |
mbed_official | 237:f3da66175598 | 5158 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 5159 | } |
mbed_official | 237:f3da66175598 | 5160 | |
mbed_official | 237:f3da66175598 | 5161 | /** |
mbed_official | 237:f3da66175598 | 5162 | * @brief Triggers the update of the registers of one or several timers |
mbed_official | 237:f3da66175598 | 5163 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5164 | * @param Timers: timers concerned with the software register update |
mbed_official | 237:f3da66175598 | 5165 | * This parameter can be any combination of the following values: |
mbed_official | 237:f3da66175598 | 5166 | * @arg HRTIM_TIMERUPDATE_MASTER |
mbed_official | 237:f3da66175598 | 5167 | * @arg HRTIM_TIMERUPDATE_A |
mbed_official | 237:f3da66175598 | 5168 | * @arg HRTIM_TIMERUPDATE_B |
mbed_official | 237:f3da66175598 | 5169 | * @arg HRTIM_TIMERUPDATE_C |
mbed_official | 237:f3da66175598 | 5170 | * @arg HRTIM_TIMERUPDATE_D |
mbed_official | 237:f3da66175598 | 5171 | * @arg HRTIM_TIMERUPDATE_E |
mbed_official | 237:f3da66175598 | 5172 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 5173 | * @note The 'software update' bits in the HRTIM conrol register 2 register are |
mbed_official | 237:f3da66175598 | 5174 | * automatically reset by hardware |
mbed_official | 237:f3da66175598 | 5175 | */ |
mbed_official | 237:f3da66175598 | 5176 | HAL_StatusTypeDef HAL_HRTIM_SoftwareUpdate(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 5177 | uint32_t Timers) |
mbed_official | 237:f3da66175598 | 5178 | { |
mbed_official | 237:f3da66175598 | 5179 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 5180 | assert_param(IS_HRTIM_TIMERUPDATE(Timers)); |
mbed_official | 237:f3da66175598 | 5181 | |
mbed_official | 237:f3da66175598 | 5182 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 5183 | { |
mbed_official | 237:f3da66175598 | 5184 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 5185 | } |
mbed_official | 237:f3da66175598 | 5186 | |
mbed_official | 237:f3da66175598 | 5187 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 5188 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5189 | |
mbed_official | 237:f3da66175598 | 5190 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 5191 | |
mbed_official | 237:f3da66175598 | 5192 | /* Force timer(s) registers update */ |
mbed_official | 237:f3da66175598 | 5193 | hhrtim->Instance->sCommonRegs.CR2 |= Timers; |
mbed_official | 237:f3da66175598 | 5194 | |
mbed_official | 237:f3da66175598 | 5195 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 5196 | |
mbed_official | 237:f3da66175598 | 5197 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 5198 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5199 | |
mbed_official | 237:f3da66175598 | 5200 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 5201 | } |
mbed_official | 237:f3da66175598 | 5202 | |
mbed_official | 237:f3da66175598 | 5203 | /** |
mbed_official | 237:f3da66175598 | 5204 | * @brief Triggers the reset of one or several timers |
mbed_official | 237:f3da66175598 | 5205 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5206 | * @param Timers: timers concerned with the software counter reset |
mbed_official | 237:f3da66175598 | 5207 | * This parameter can be any combination of the following values: |
mbed_official | 237:f3da66175598 | 5208 | * @arg HRTIM_TIMERRESET_MASTER |
mbed_official | 237:f3da66175598 | 5209 | * @arg HRTIM_TIMERRESET_TIMER_A |
mbed_official | 237:f3da66175598 | 5210 | * @arg HRTIM_TIMERRESET_TIMER_B |
mbed_official | 237:f3da66175598 | 5211 | * @arg HRTIM_TIMERRESET_TIMER_C |
mbed_official | 237:f3da66175598 | 5212 | * @arg HRTIM_TIMERRESET_TIMER_D |
mbed_official | 237:f3da66175598 | 5213 | * @arg HRTIM_TIMERRESET_TIMER_E |
mbed_official | 237:f3da66175598 | 5214 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 5215 | * @note The 'software reset' bits in the HRTIM conrol register 2 are |
mbed_official | 237:f3da66175598 | 5216 | * automatically reset by hardware |
mbed_official | 237:f3da66175598 | 5217 | */ |
mbed_official | 237:f3da66175598 | 5218 | HAL_StatusTypeDef HAL_HRTIM_SoftwareReset(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 5219 | uint32_t Timers) |
mbed_official | 237:f3da66175598 | 5220 | { |
mbed_official | 237:f3da66175598 | 5221 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 5222 | assert_param(IS_HRTIM_TIMERRESET(Timers)); |
mbed_official | 237:f3da66175598 | 5223 | |
mbed_official | 237:f3da66175598 | 5224 | if(hhrtim->State == HAL_HRTIM_STATE_BUSY) |
mbed_official | 237:f3da66175598 | 5225 | { |
mbed_official | 237:f3da66175598 | 5226 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 5227 | } |
mbed_official | 237:f3da66175598 | 5228 | |
mbed_official | 237:f3da66175598 | 5229 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 5230 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5231 | |
mbed_official | 237:f3da66175598 | 5232 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 5233 | |
mbed_official | 237:f3da66175598 | 5234 | /* Force timer(s) registers reset */ |
mbed_official | 237:f3da66175598 | 5235 | hhrtim->Instance->sCommonRegs.CR2 = Timers; |
mbed_official | 237:f3da66175598 | 5236 | |
mbed_official | 237:f3da66175598 | 5237 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 5238 | |
mbed_official | 237:f3da66175598 | 5239 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 5240 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5241 | |
mbed_official | 237:f3da66175598 | 5242 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 5243 | } |
mbed_official | 237:f3da66175598 | 5244 | |
mbed_official | 237:f3da66175598 | 5245 | /** |
mbed_official | 237:f3da66175598 | 5246 | * @brief Starts a burst DMA operation to update HRTIM control registers content |
mbed_official | 237:f3da66175598 | 5247 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5248 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 5249 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 5250 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 5251 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 5252 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 5253 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 5254 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 5255 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 5256 | * @param BurstBufferAddress: address of the buffer the HRTIM control registers |
mbed_official | 237:f3da66175598 | 5257 | * content will be updated from. |
mbed_official | 237:f3da66175598 | 5258 | * @param BurstBufferLength: size (in WORDS) of the burst buffer. |
mbed_official | 237:f3da66175598 | 5259 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 5260 | * @note The TimerIdx parameter determines the dma channel to be used by the |
mbed_official | 237:f3da66175598 | 5261 | * DMA burst controller (see below) |
mbed_official | 237:f3da66175598 | 5262 | * HRTIM_TIMERINDEX_MASTER: DMA channel 2 is used by the DMA burst controller |
mbed_official | 237:f3da66175598 | 5263 | * HRTIM_TIMERINDEX_TIMER_A: DMA channel 3 is used by the DMA burst controller |
mbed_official | 237:f3da66175598 | 5264 | * HRTIM_TIMERINDEX_TIMER_B: DMA channel 4 is used by the DMA burst controller |
mbed_official | 237:f3da66175598 | 5265 | * HRTIM_TIMERINDEX_TIMER_C: DMA channel 5 is used by the DMA burst controller |
mbed_official | 237:f3da66175598 | 5266 | * HRTIM_TIMERINDEX_TIMER_D: DMA channel 6 is used by the DMA burst controller |
mbed_official | 237:f3da66175598 | 5267 | * HRTIM_TIMERINDEX_TIMER_E: DMA channel 7 is used by the DMA burst controller |
mbed_official | 237:f3da66175598 | 5268 | */ |
mbed_official | 237:f3da66175598 | 5269 | HAL_StatusTypeDef HAL_HRTIM_BurstDMATransfer(HRTIM_HandleTypeDef *hhrtim, |
mbed_official | 237:f3da66175598 | 5270 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 5271 | uint32_t BurstBufferAddress, |
mbed_official | 237:f3da66175598 | 5272 | uint32_t BurstBufferLength) |
mbed_official | 237:f3da66175598 | 5273 | { |
mbed_official | 237:f3da66175598 | 5274 | DMA_HandleTypeDef * hdma; |
mbed_official | 237:f3da66175598 | 5275 | |
mbed_official | 237:f3da66175598 | 5276 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 5277 | assert_param(IS_HRTIM_TIMERINDEX(TimerIdx)); |
mbed_official | 237:f3da66175598 | 5278 | |
mbed_official | 237:f3da66175598 | 5279 | if((hhrtim->State == HAL_HRTIM_STATE_BUSY)) |
mbed_official | 237:f3da66175598 | 5280 | { |
mbed_official | 237:f3da66175598 | 5281 | return HAL_BUSY; |
mbed_official | 237:f3da66175598 | 5282 | } |
mbed_official | 237:f3da66175598 | 5283 | if((hhrtim->State == HAL_HRTIM_STATE_READY)) |
mbed_official | 237:f3da66175598 | 5284 | { |
mbed_official | 237:f3da66175598 | 5285 | if((BurstBufferAddress == 0 ) || (BurstBufferLength == 0)) |
mbed_official | 237:f3da66175598 | 5286 | { |
mbed_official | 237:f3da66175598 | 5287 | return HAL_ERROR; |
mbed_official | 237:f3da66175598 | 5288 | } |
mbed_official | 237:f3da66175598 | 5289 | else |
mbed_official | 237:f3da66175598 | 5290 | { |
mbed_official | 237:f3da66175598 | 5291 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 5292 | } |
mbed_official | 237:f3da66175598 | 5293 | } |
mbed_official | 237:f3da66175598 | 5294 | |
mbed_official | 237:f3da66175598 | 5295 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 5296 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5297 | |
mbed_official | 237:f3da66175598 | 5298 | /* Get the timer DMA handler */ |
mbed_official | 237:f3da66175598 | 5299 | hdma = HRTIM_GetDMAHandleFromTimerIdx(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 5300 | |
mbed_official | 237:f3da66175598 | 5301 | /* Set the DMA transfer completed callback */ |
mbed_official | 237:f3da66175598 | 5302 | hdma->XferCpltCallback = HRTIM_BurstDMACplt; |
mbed_official | 237:f3da66175598 | 5303 | |
mbed_official | 237:f3da66175598 | 5304 | /* Set the DMA error callback */ |
mbed_official | 237:f3da66175598 | 5305 | hdma->XferErrorCallback = HRTIM_DMAError ; |
mbed_official | 237:f3da66175598 | 5306 | |
mbed_official | 237:f3da66175598 | 5307 | /* Enable the DMA channel */ |
mbed_official | 237:f3da66175598 | 5308 | HAL_DMA_Start_IT(hdma, |
mbed_official | 237:f3da66175598 | 5309 | BurstBufferAddress, |
mbed_official | 237:f3da66175598 | 5310 | (uint32_t)&(hhrtim->Instance->sCommonRegs.BDMADR), |
mbed_official | 237:f3da66175598 | 5311 | BurstBufferLength); |
mbed_official | 237:f3da66175598 | 5312 | |
mbed_official | 237:f3da66175598 | 5313 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 5314 | |
mbed_official | 237:f3da66175598 | 5315 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 5316 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5317 | |
mbed_official | 237:f3da66175598 | 5318 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 5319 | } |
mbed_official | 237:f3da66175598 | 5320 | |
mbed_official | 237:f3da66175598 | 5321 | /** |
mbed_official | 237:f3da66175598 | 5322 | * @brief Enables the transfer from preload to active registers for one |
mbed_official | 237:f3da66175598 | 5323 | * or several timing units (including master timer) |
mbed_official | 237:f3da66175598 | 5324 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5325 | * @param Timers: Timer(s) concerned by the register preload enabling command |
mbed_official | 237:f3da66175598 | 5326 | * This parameter can be any combination of the following values: |
mbed_official | 237:f3da66175598 | 5327 | * @arg HRTIM_TIMERUPDATE_MASTER |
mbed_official | 237:f3da66175598 | 5328 | * @arg HRTIM_TIMERUPDATE_A |
mbed_official | 237:f3da66175598 | 5329 | * @arg HRTIM_TIMERUPDATE_B |
mbed_official | 237:f3da66175598 | 5330 | * @arg HRTIM_TIMERUPDATE_C |
mbed_official | 237:f3da66175598 | 5331 | * @arg HRTIM_TIMERUPDATE_D |
mbed_official | 237:f3da66175598 | 5332 | * @arg HRTIM_TIMERUPDATE_E |
mbed_official | 237:f3da66175598 | 5333 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 5334 | */ |
mbed_official | 237:f3da66175598 | 5335 | HAL_StatusTypeDef HAL_HRTIM_UpdateEnable(HRTIM_HandleTypeDef *hhrtim, |
mbed_official | 237:f3da66175598 | 5336 | uint32_t Timers) |
mbed_official | 237:f3da66175598 | 5337 | { |
mbed_official | 237:f3da66175598 | 5338 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 5339 | assert_param(IS_HRTIM_TIMERUPDATE(Timers)); |
mbed_official | 237:f3da66175598 | 5340 | |
mbed_official | 237:f3da66175598 | 5341 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 5342 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5343 | |
mbed_official | 237:f3da66175598 | 5344 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 5345 | |
mbed_official | 237:f3da66175598 | 5346 | /* Enable timer(s) registers update */ |
mbed_official | 237:f3da66175598 | 5347 | hhrtim->Instance->sCommonRegs.CR1 &= ~(Timers); |
mbed_official | 237:f3da66175598 | 5348 | |
mbed_official | 237:f3da66175598 | 5349 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 5350 | |
mbed_official | 237:f3da66175598 | 5351 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 5352 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5353 | |
mbed_official | 237:f3da66175598 | 5354 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 5355 | } |
mbed_official | 237:f3da66175598 | 5356 | |
mbed_official | 237:f3da66175598 | 5357 | /** |
mbed_official | 237:f3da66175598 | 5358 | * @brief Disables the transfer from preload to active registers for one |
mbed_official | 237:f3da66175598 | 5359 | * or several timing units (including master timer) |
mbed_official | 237:f3da66175598 | 5360 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5361 | * @param Timers: Timer(s) concerned by the register preload disabling command |
mbed_official | 237:f3da66175598 | 5362 | * This parameter can be any combination of the following values: |
mbed_official | 237:f3da66175598 | 5363 | * @arg HRTIM_TIMERUPDATE_MASTER |
mbed_official | 237:f3da66175598 | 5364 | * @arg HRTIM_TIMERUPDATE_A |
mbed_official | 237:f3da66175598 | 5365 | * @arg HRTIM_TIMERUPDATE_B |
mbed_official | 237:f3da66175598 | 5366 | * @arg HRTIM_TIMERUPDATE_C |
mbed_official | 237:f3da66175598 | 5367 | * @arg HRTIM_TIMERUPDATE_D |
mbed_official | 237:f3da66175598 | 5368 | * @arg HRTIM_TIMERUPDATE_E |
mbed_official | 237:f3da66175598 | 5369 | * @retval HAL status |
mbed_official | 237:f3da66175598 | 5370 | */ |
mbed_official | 237:f3da66175598 | 5371 | HAL_StatusTypeDef HAL_HRTIM_UpdateDisable(HRTIM_HandleTypeDef *hhrtim, |
mbed_official | 237:f3da66175598 | 5372 | uint32_t Timers) |
mbed_official | 237:f3da66175598 | 5373 | { |
mbed_official | 237:f3da66175598 | 5374 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 5375 | assert_param(IS_HRTIM_TIMERUPDATE(Timers)); |
mbed_official | 237:f3da66175598 | 5376 | |
mbed_official | 237:f3da66175598 | 5377 | /* Process Locked */ |
mbed_official | 237:f3da66175598 | 5378 | __HAL_LOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5379 | |
mbed_official | 237:f3da66175598 | 5380 | hhrtim->State = HAL_HRTIM_STATE_BUSY; |
mbed_official | 237:f3da66175598 | 5381 | |
mbed_official | 237:f3da66175598 | 5382 | /* Enable timer(s) registers update */ |
mbed_official | 237:f3da66175598 | 5383 | hhrtim->Instance->sCommonRegs.CR1 |= (Timers); |
mbed_official | 237:f3da66175598 | 5384 | |
mbed_official | 237:f3da66175598 | 5385 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 5386 | |
mbed_official | 237:f3da66175598 | 5387 | /* Process Unlocked */ |
mbed_official | 237:f3da66175598 | 5388 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 5389 | |
mbed_official | 237:f3da66175598 | 5390 | return HAL_OK; |
mbed_official | 237:f3da66175598 | 5391 | } |
mbed_official | 237:f3da66175598 | 5392 | |
mbed_official | 237:f3da66175598 | 5393 | /** |
mbed_official | 237:f3da66175598 | 5394 | * @} |
mbed_official | 237:f3da66175598 | 5395 | */ |
mbed_official | 237:f3da66175598 | 5396 | |
mbed_official | 237:f3da66175598 | 5397 | /** @defgroup HAL_HRTIM_Group9 HRTIM peripheral state functions |
mbed_official | 237:f3da66175598 | 5398 | * @brief Functions used to get HRTIM or HRTIM timer specific |
mbed_official | 237:f3da66175598 | 5399 | * information. |
mbed_official | 237:f3da66175598 | 5400 | * |
mbed_official | 237:f3da66175598 | 5401 | @verbatim |
mbed_official | 237:f3da66175598 | 5402 | =============================================================================== |
mbed_official | 237:f3da66175598 | 5403 | ##### Peripheral State functions ##### |
mbed_official | 237:f3da66175598 | 5404 | =============================================================================== |
mbed_official | 237:f3da66175598 | 5405 | [..] This section provides functions allowing to: |
mbed_official | 237:f3da66175598 | 5406 | (+) Get HRTIM HAL state |
mbed_official | 237:f3da66175598 | 5407 | (+) Get captured value |
mbed_official | 237:f3da66175598 | 5408 | (+) Get HRTIM timer output level |
mbed_official | 237:f3da66175598 | 5409 | (+) Get HRTIM timer output state |
mbed_official | 237:f3da66175598 | 5410 | (+) Get delayed protection status |
mbed_official | 237:f3da66175598 | 5411 | (+) Get burst status |
mbed_official | 237:f3da66175598 | 5412 | (+) Get current push-pull status |
mbed_official | 237:f3da66175598 | 5413 | (+) Get idle push-pull status |
mbed_official | 237:f3da66175598 | 5414 | |
mbed_official | 237:f3da66175598 | 5415 | @endverbatim |
mbed_official | 237:f3da66175598 | 5416 | * @{ |
mbed_official | 237:f3da66175598 | 5417 | */ |
mbed_official | 237:f3da66175598 | 5418 | |
mbed_official | 237:f3da66175598 | 5419 | /** |
mbed_official | 237:f3da66175598 | 5420 | * @brief return the HRTIM HAL state |
mbed_official | 237:f3da66175598 | 5421 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5422 | * @retval HAL state |
mbed_official | 237:f3da66175598 | 5423 | */ |
mbed_official | 237:f3da66175598 | 5424 | HAL_HRTIM_StateTypeDef HAL_HRTIM_GetState(HRTIM_HandleTypeDef* hhrtim) |
mbed_official | 237:f3da66175598 | 5425 | { |
mbed_official | 237:f3da66175598 | 5426 | /* Return ADC state */ |
mbed_official | 237:f3da66175598 | 5427 | return hhrtim->State; |
mbed_official | 237:f3da66175598 | 5428 | } |
mbed_official | 237:f3da66175598 | 5429 | |
mbed_official | 237:f3da66175598 | 5430 | /** |
mbed_official | 237:f3da66175598 | 5431 | * @brief Returns actual value of the capture register of the designated capture unit |
mbed_official | 237:f3da66175598 | 5432 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5433 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 5434 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 5435 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 5436 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 5437 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 5438 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 5439 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 5440 | * @param CaptureUnit: Capture unit to trig |
mbed_official | 237:f3da66175598 | 5441 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 5442 | * @arg HRTIM_CAPTUREUNIT_1: Capture unit 1 |
mbed_official | 237:f3da66175598 | 5443 | * @arg HRTIM_CAPTUREUNIT_2: Capture unit 2 |
mbed_official | 237:f3da66175598 | 5444 | * @retval Captured value |
mbed_official | 237:f3da66175598 | 5445 | */ |
mbed_official | 237:f3da66175598 | 5446 | uint32_t HAL_HRTIM_GetCapturedValue(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 5447 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 5448 | uint32_t CaptureUnit) |
mbed_official | 237:f3da66175598 | 5449 | { |
mbed_official | 237:f3da66175598 | 5450 | uint32_t captured_value = 0; |
mbed_official | 237:f3da66175598 | 5451 | |
mbed_official | 237:f3da66175598 | 5452 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 5453 | assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); |
mbed_official | 237:f3da66175598 | 5454 | assert_param(IS_HRTIM_CAPTUREUNIT(CaptureUnit)); |
mbed_official | 237:f3da66175598 | 5455 | |
mbed_official | 237:f3da66175598 | 5456 | /* Read captured value */ |
mbed_official | 237:f3da66175598 | 5457 | switch (CaptureUnit) |
mbed_official | 237:f3da66175598 | 5458 | { |
mbed_official | 237:f3da66175598 | 5459 | case HRTIM_CAPTUREUNIT_1: |
mbed_official | 237:f3da66175598 | 5460 | { |
mbed_official | 237:f3da66175598 | 5461 | captured_value = hhrtim->Instance->sTimerxRegs[TimerIdx].CPT1xR; |
mbed_official | 237:f3da66175598 | 5462 | } |
mbed_official | 237:f3da66175598 | 5463 | break; |
mbed_official | 237:f3da66175598 | 5464 | case HRTIM_CAPTUREUNIT_2: |
mbed_official | 237:f3da66175598 | 5465 | { |
mbed_official | 237:f3da66175598 | 5466 | captured_value = hhrtim->Instance->sTimerxRegs[TimerIdx].CPT2xR; |
mbed_official | 237:f3da66175598 | 5467 | } |
mbed_official | 237:f3da66175598 | 5468 | break; |
mbed_official | 237:f3da66175598 | 5469 | } |
mbed_official | 237:f3da66175598 | 5470 | |
mbed_official | 237:f3da66175598 | 5471 | return captured_value; |
mbed_official | 237:f3da66175598 | 5472 | } |
mbed_official | 237:f3da66175598 | 5473 | |
mbed_official | 237:f3da66175598 | 5474 | /** |
mbed_official | 237:f3da66175598 | 5475 | * @brief Returns actual level (active or inactive) of the designated output |
mbed_official | 237:f3da66175598 | 5476 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5477 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 5478 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 5479 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 5480 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 5481 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 5482 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 5483 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 5484 | * @param Output: Timer output |
mbed_official | 237:f3da66175598 | 5485 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 5486 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 5487 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 5488 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 5489 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 5490 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 5491 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 5492 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 5493 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 5494 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 5495 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 5496 | * @retval Output level |
mbed_official | 237:f3da66175598 | 5497 | * @note Returned output level is taken before the output stage (chopper, |
mbed_official | 237:f3da66175598 | 5498 | * polarity). |
mbed_official | 237:f3da66175598 | 5499 | */ |
mbed_official | 237:f3da66175598 | 5500 | uint32_t HAL_HRTIM_WaveformGetOutputLevel(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 5501 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 5502 | uint32_t Output) |
mbed_official | 237:f3da66175598 | 5503 | { |
mbed_official | 237:f3da66175598 | 5504 | uint32_t output_level = HRTIM_OUTPUTLEVEL_INACTIVE; |
mbed_official | 237:f3da66175598 | 5505 | |
mbed_official | 237:f3da66175598 | 5506 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 5507 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, Output)); |
mbed_official | 237:f3da66175598 | 5508 | |
mbed_official | 237:f3da66175598 | 5509 | /* Read the output level */ |
mbed_official | 237:f3da66175598 | 5510 | switch (Output) |
mbed_official | 237:f3da66175598 | 5511 | { |
mbed_official | 237:f3da66175598 | 5512 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 5513 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 5514 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 5515 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 5516 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 5517 | { |
mbed_official | 237:f3da66175598 | 5518 | if ((hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxISR & HRTIM_TIMISR_O1CPY) != RESET) |
mbed_official | 237:f3da66175598 | 5519 | { |
mbed_official | 237:f3da66175598 | 5520 | output_level = HRTIM_OUTPUTLEVEL_ACTIVE; |
mbed_official | 237:f3da66175598 | 5521 | } |
mbed_official | 237:f3da66175598 | 5522 | else |
mbed_official | 237:f3da66175598 | 5523 | { |
mbed_official | 237:f3da66175598 | 5524 | output_level = HRTIM_OUTPUTLEVEL_INACTIVE; |
mbed_official | 237:f3da66175598 | 5525 | } |
mbed_official | 237:f3da66175598 | 5526 | } |
mbed_official | 237:f3da66175598 | 5527 | break; |
mbed_official | 237:f3da66175598 | 5528 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 5529 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 5530 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 5531 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 5532 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 5533 | { |
mbed_official | 237:f3da66175598 | 5534 | if ((hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxISR & HRTIM_TIMISR_O2CPY) != RESET) |
mbed_official | 237:f3da66175598 | 5535 | { |
mbed_official | 237:f3da66175598 | 5536 | output_level = HRTIM_OUTPUTLEVEL_ACTIVE; |
mbed_official | 237:f3da66175598 | 5537 | } |
mbed_official | 237:f3da66175598 | 5538 | else |
mbed_official | 237:f3da66175598 | 5539 | { |
mbed_official | 237:f3da66175598 | 5540 | output_level = HRTIM_OUTPUTLEVEL_INACTIVE; |
mbed_official | 237:f3da66175598 | 5541 | } |
mbed_official | 237:f3da66175598 | 5542 | } |
mbed_official | 237:f3da66175598 | 5543 | break; |
mbed_official | 237:f3da66175598 | 5544 | } |
mbed_official | 237:f3da66175598 | 5545 | |
mbed_official | 237:f3da66175598 | 5546 | return output_level; |
mbed_official | 237:f3da66175598 | 5547 | } |
mbed_official | 237:f3da66175598 | 5548 | |
mbed_official | 237:f3da66175598 | 5549 | /** |
mbed_official | 237:f3da66175598 | 5550 | * @brief Returns actual state (RUN, IDLE, FAULT) of the designated output |
mbed_official | 237:f3da66175598 | 5551 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5552 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 5553 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 5554 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 5555 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 5556 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 5557 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 5558 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 5559 | * @param Output: Timer output |
mbed_official | 237:f3da66175598 | 5560 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 5561 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 5562 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 5563 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 5564 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 5565 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 5566 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 5567 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 5568 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 5569 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 5570 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 5571 | * @retval Output state |
mbed_official | 237:f3da66175598 | 5572 | */ |
mbed_official | 237:f3da66175598 | 5573 | uint32_t HAL_HRTIM_WaveformGetOutputState(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 5574 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 5575 | uint32_t Output) |
mbed_official | 237:f3da66175598 | 5576 | { |
mbed_official | 237:f3da66175598 | 5577 | uint32_t output_bit = 0; |
mbed_official | 237:f3da66175598 | 5578 | uint32_t output_state = HRTIM_OUTPUTSTATE_IDLE; |
mbed_official | 237:f3da66175598 | 5579 | |
mbed_official | 237:f3da66175598 | 5580 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 5581 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, Output)); |
mbed_official | 237:f3da66175598 | 5582 | |
mbed_official | 237:f3da66175598 | 5583 | /* Set output state according to output control status and output disable status */ |
mbed_official | 237:f3da66175598 | 5584 | switch (Output) |
mbed_official | 237:f3da66175598 | 5585 | { |
mbed_official | 237:f3da66175598 | 5586 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 5587 | { |
mbed_official | 237:f3da66175598 | 5588 | output_bit = HRTIM_OENR_TA1OEN; |
mbed_official | 237:f3da66175598 | 5589 | } |
mbed_official | 237:f3da66175598 | 5590 | break; |
mbed_official | 237:f3da66175598 | 5591 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 5592 | { |
mbed_official | 237:f3da66175598 | 5593 | output_bit = HRTIM_OENR_TA2OEN; |
mbed_official | 237:f3da66175598 | 5594 | } |
mbed_official | 237:f3da66175598 | 5595 | break; |
mbed_official | 237:f3da66175598 | 5596 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 5597 | { |
mbed_official | 237:f3da66175598 | 5598 | output_bit = HRTIM_OENR_TB1OEN; |
mbed_official | 237:f3da66175598 | 5599 | } |
mbed_official | 237:f3da66175598 | 5600 | break; |
mbed_official | 237:f3da66175598 | 5601 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 5602 | { |
mbed_official | 237:f3da66175598 | 5603 | output_bit = HRTIM_OENR_TB2OEN; |
mbed_official | 237:f3da66175598 | 5604 | } |
mbed_official | 237:f3da66175598 | 5605 | break; |
mbed_official | 237:f3da66175598 | 5606 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 5607 | { |
mbed_official | 237:f3da66175598 | 5608 | output_bit = HRTIM_OENR_TC1OEN; |
mbed_official | 237:f3da66175598 | 5609 | } |
mbed_official | 237:f3da66175598 | 5610 | break; |
mbed_official | 237:f3da66175598 | 5611 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 5612 | { |
mbed_official | 237:f3da66175598 | 5613 | output_bit = HRTIM_OENR_TC2OEN; |
mbed_official | 237:f3da66175598 | 5614 | } |
mbed_official | 237:f3da66175598 | 5615 | break; |
mbed_official | 237:f3da66175598 | 5616 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 5617 | { |
mbed_official | 237:f3da66175598 | 5618 | output_bit = HRTIM_OENR_TD1OEN; |
mbed_official | 237:f3da66175598 | 5619 | } |
mbed_official | 237:f3da66175598 | 5620 | break; |
mbed_official | 237:f3da66175598 | 5621 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 5622 | { |
mbed_official | 237:f3da66175598 | 5623 | output_bit = HRTIM_OENR_TD2OEN; |
mbed_official | 237:f3da66175598 | 5624 | } |
mbed_official | 237:f3da66175598 | 5625 | break; |
mbed_official | 237:f3da66175598 | 5626 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 5627 | { |
mbed_official | 237:f3da66175598 | 5628 | output_bit = HRTIM_OENR_TE1OEN; |
mbed_official | 237:f3da66175598 | 5629 | } |
mbed_official | 237:f3da66175598 | 5630 | break; |
mbed_official | 237:f3da66175598 | 5631 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 5632 | { |
mbed_official | 237:f3da66175598 | 5633 | output_bit = HRTIM_OENR_TE2OEN; |
mbed_official | 237:f3da66175598 | 5634 | } |
mbed_official | 237:f3da66175598 | 5635 | break; |
mbed_official | 237:f3da66175598 | 5636 | } |
mbed_official | 237:f3da66175598 | 5637 | |
mbed_official | 237:f3da66175598 | 5638 | if ((hhrtim->Instance->sCommonRegs.OENR & output_bit) != RESET) |
mbed_official | 237:f3da66175598 | 5639 | { |
mbed_official | 237:f3da66175598 | 5640 | /* Output is enabled: output in RUN state (whatever ouput disable status is)*/ |
mbed_official | 237:f3da66175598 | 5641 | output_state = HRTIM_OUTPUTSTATE_RUN; |
mbed_official | 237:f3da66175598 | 5642 | } |
mbed_official | 237:f3da66175598 | 5643 | else |
mbed_official | 237:f3da66175598 | 5644 | { |
mbed_official | 237:f3da66175598 | 5645 | if ((hhrtim->Instance->sCommonRegs.ODSR & output_bit) != RESET) |
mbed_official | 237:f3da66175598 | 5646 | { |
mbed_official | 237:f3da66175598 | 5647 | /* Output is disabled: output in FAULT state */ |
mbed_official | 237:f3da66175598 | 5648 | output_state = HRTIM_OUTPUTSTATE_FAULT; |
mbed_official | 237:f3da66175598 | 5649 | } |
mbed_official | 237:f3da66175598 | 5650 | else |
mbed_official | 237:f3da66175598 | 5651 | { |
mbed_official | 237:f3da66175598 | 5652 | /* Output is disabled: output in IDLE state */ |
mbed_official | 237:f3da66175598 | 5653 | output_state = HRTIM_OUTPUTSTATE_IDLE; |
mbed_official | 237:f3da66175598 | 5654 | } |
mbed_official | 237:f3da66175598 | 5655 | } |
mbed_official | 237:f3da66175598 | 5656 | |
mbed_official | 237:f3da66175598 | 5657 | return(output_state); |
mbed_official | 237:f3da66175598 | 5658 | } |
mbed_official | 237:f3da66175598 | 5659 | |
mbed_official | 237:f3da66175598 | 5660 | /** |
mbed_official | 237:f3da66175598 | 5661 | * @brief Returns the level (active or inactive) of the designated output |
mbed_official | 237:f3da66175598 | 5662 | * when the delayed protection was triggered |
mbed_official | 237:f3da66175598 | 5663 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5664 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 5665 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 5666 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 5667 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 5668 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 5669 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 5670 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 5671 | * @param Output: Timer output |
mbed_official | 237:f3da66175598 | 5672 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 5673 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 5674 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 5675 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 5676 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 5677 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 5678 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 5679 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 5680 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 5681 | * @arg HRTIM_OUTPUT_TD1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 5682 | * @arg HRTIM_OUTPUT_TD2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 5683 | * @retval Delayed protection status |
mbed_official | 237:f3da66175598 | 5684 | */ |
mbed_official | 237:f3da66175598 | 5685 | uint32_t HAL_HRTIM_GetDelayedProtectionStatus(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 5686 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 5687 | uint32_t Output) |
mbed_official | 237:f3da66175598 | 5688 | { |
mbed_official | 237:f3da66175598 | 5689 | uint32_t delayed_protection_status = HRTIM_OUTPUTLEVEL_INACTIVE; |
mbed_official | 237:f3da66175598 | 5690 | |
mbed_official | 237:f3da66175598 | 5691 | /* Check parameters */ |
mbed_official | 237:f3da66175598 | 5692 | assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, Output)); |
mbed_official | 237:f3da66175598 | 5693 | |
mbed_official | 237:f3da66175598 | 5694 | /* Read the delayed protection status */ |
mbed_official | 237:f3da66175598 | 5695 | switch (Output) |
mbed_official | 237:f3da66175598 | 5696 | { |
mbed_official | 237:f3da66175598 | 5697 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 5698 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 5699 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 5700 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 5701 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 5702 | { |
mbed_official | 237:f3da66175598 | 5703 | if ((hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxISR & HRTIM_TIMISR_O1STAT) != RESET) |
mbed_official | 237:f3da66175598 | 5704 | { |
mbed_official | 237:f3da66175598 | 5705 | /* Output 1 was active when the delayed idle protection was triggered */ |
mbed_official | 237:f3da66175598 | 5706 | delayed_protection_status = HRTIM_OUTPUTLEVEL_ACTIVE; |
mbed_official | 237:f3da66175598 | 5707 | } |
mbed_official | 237:f3da66175598 | 5708 | else |
mbed_official | 237:f3da66175598 | 5709 | { |
mbed_official | 237:f3da66175598 | 5710 | /* Output 1 was inactive when the delayed idle protection was triggered */ |
mbed_official | 237:f3da66175598 | 5711 | delayed_protection_status = HRTIM_OUTPUTLEVEL_INACTIVE; |
mbed_official | 237:f3da66175598 | 5712 | } |
mbed_official | 237:f3da66175598 | 5713 | } |
mbed_official | 237:f3da66175598 | 5714 | break; |
mbed_official | 237:f3da66175598 | 5715 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 5716 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 5717 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 5718 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 5719 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 5720 | { |
mbed_official | 237:f3da66175598 | 5721 | if ((hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxISR & HRTIM_TIMISR_O2STAT) != RESET) |
mbed_official | 237:f3da66175598 | 5722 | { |
mbed_official | 237:f3da66175598 | 5723 | /* Output 2 was active when the delayed idle protection was triggered */ |
mbed_official | 237:f3da66175598 | 5724 | delayed_protection_status = HRTIM_OUTPUTLEVEL_ACTIVE; |
mbed_official | 237:f3da66175598 | 5725 | } |
mbed_official | 237:f3da66175598 | 5726 | else |
mbed_official | 237:f3da66175598 | 5727 | { |
mbed_official | 237:f3da66175598 | 5728 | /* Output 2 was inactive when the delayed idle protection was triggered */ |
mbed_official | 237:f3da66175598 | 5729 | delayed_protection_status = HRTIM_OUTPUTLEVEL_INACTIVE; |
mbed_official | 237:f3da66175598 | 5730 | } |
mbed_official | 237:f3da66175598 | 5731 | } |
mbed_official | 237:f3da66175598 | 5732 | break; |
mbed_official | 237:f3da66175598 | 5733 | } |
mbed_official | 237:f3da66175598 | 5734 | |
mbed_official | 237:f3da66175598 | 5735 | return delayed_protection_status; |
mbed_official | 237:f3da66175598 | 5736 | } |
mbed_official | 237:f3da66175598 | 5737 | |
mbed_official | 237:f3da66175598 | 5738 | /** |
mbed_official | 237:f3da66175598 | 5739 | * @brief Returns the actual status (active or inactive) of the burst mode controller |
mbed_official | 237:f3da66175598 | 5740 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5741 | * @retval Burst mode controller status |
mbed_official | 237:f3da66175598 | 5742 | */ |
mbed_official | 237:f3da66175598 | 5743 | uint32_t HAL_HRTIM_GetBurstStatus(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 5744 | { |
mbed_official | 237:f3da66175598 | 5745 | uint32_t burst_mode_status; |
mbed_official | 237:f3da66175598 | 5746 | |
mbed_official | 237:f3da66175598 | 5747 | /* Read burst mode status */ |
mbed_official | 237:f3da66175598 | 5748 | burst_mode_status = (hhrtim->Instance->sCommonRegs.BMCR & HRTIM_BMCR_BMSTAT); |
mbed_official | 237:f3da66175598 | 5749 | |
mbed_official | 237:f3da66175598 | 5750 | return burst_mode_status; |
mbed_official | 237:f3da66175598 | 5751 | } |
mbed_official | 237:f3da66175598 | 5752 | |
mbed_official | 237:f3da66175598 | 5753 | /** |
mbed_official | 237:f3da66175598 | 5754 | * @brief Indicates on which output the signal is currently active (when the |
mbed_official | 237:f3da66175598 | 5755 | * push pull mode is enabled) |
mbed_official | 237:f3da66175598 | 5756 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5757 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 5758 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 5759 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 5760 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 5761 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 5762 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 5763 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 5764 | * @retval Burst mode controller status |
mbed_official | 237:f3da66175598 | 5765 | */ |
mbed_official | 237:f3da66175598 | 5766 | uint32_t HAL_HRTIM_GetCurrentPushPullStatus(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 5767 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 5768 | { |
mbed_official | 237:f3da66175598 | 5769 | uint32_t current_pushpull_status; |
mbed_official | 237:f3da66175598 | 5770 | |
mbed_official | 237:f3da66175598 | 5771 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 5772 | assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); |
mbed_official | 237:f3da66175598 | 5773 | |
mbed_official | 237:f3da66175598 | 5774 | /* Read current push pull status */ |
mbed_official | 237:f3da66175598 | 5775 | current_pushpull_status = (hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxISR & HRTIM_TIMISR_CPPSTAT); |
mbed_official | 237:f3da66175598 | 5776 | |
mbed_official | 237:f3da66175598 | 5777 | return current_pushpull_status; |
mbed_official | 237:f3da66175598 | 5778 | } |
mbed_official | 237:f3da66175598 | 5779 | |
mbed_official | 237:f3da66175598 | 5780 | |
mbed_official | 237:f3da66175598 | 5781 | /** |
mbed_official | 237:f3da66175598 | 5782 | * @brief Indicates on which output the signal was applied, in push-pull mode |
mbed_official | 237:f3da66175598 | 5783 | balanced fault mode or delayed idle mode, when the protection was triggered |
mbed_official | 237:f3da66175598 | 5784 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5785 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 5786 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 5787 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 5788 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 5789 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 5790 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 5791 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 5792 | * @retval Idle Push Pull Status |
mbed_official | 237:f3da66175598 | 5793 | */ |
mbed_official | 237:f3da66175598 | 5794 | uint32_t HAL_HRTIM_GetIdlePushPullStatus(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 5795 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 5796 | { |
mbed_official | 237:f3da66175598 | 5797 | uint32_t idle_pushpull_status; |
mbed_official | 237:f3da66175598 | 5798 | |
mbed_official | 237:f3da66175598 | 5799 | /* Check the parameters */ |
mbed_official | 237:f3da66175598 | 5800 | assert_param(IS_HRTIM_TIMING_UNIT(TimerIdx)); |
mbed_official | 237:f3da66175598 | 5801 | |
mbed_official | 237:f3da66175598 | 5802 | /* Read current push pull status */ |
mbed_official | 237:f3da66175598 | 5803 | idle_pushpull_status = (hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxISR & HRTIM_TIMISR_IPPSTAT); |
mbed_official | 237:f3da66175598 | 5804 | |
mbed_official | 237:f3da66175598 | 5805 | return idle_pushpull_status; |
mbed_official | 237:f3da66175598 | 5806 | } |
mbed_official | 237:f3da66175598 | 5807 | |
mbed_official | 237:f3da66175598 | 5808 | /** |
mbed_official | 237:f3da66175598 | 5809 | * @} |
mbed_official | 237:f3da66175598 | 5810 | */ |
mbed_official | 237:f3da66175598 | 5811 | |
mbed_official | 237:f3da66175598 | 5812 | /** @defgroup HAL_HRTIM_Group10 HRTIM interrupts handling |
mbed_official | 237:f3da66175598 | 5813 | * @brief Functions called when HRTIM generates an interrupt |
mbed_official | 237:f3da66175598 | 5814 | * 7 interrupts can be generated by the master timer: |
mbed_official | 237:f3da66175598 | 5815 | * - Master timer registers update |
mbed_official | 237:f3da66175598 | 5816 | * - Synchronization event received |
mbed_official | 237:f3da66175598 | 5817 | * - Master timer repetition event |
mbed_official | 237:f3da66175598 | 5818 | * - Master Compare 1 to 4 event |
mbed_official | 237:f3da66175598 | 5819 | * 14 interrupts can be generated by each timing unit: |
mbed_official | 237:f3da66175598 | 5820 | * - Delayed protection triggered |
mbed_official | 237:f3da66175598 | 5821 | * - Counter reset or roll-over event |
mbed_official | 237:f3da66175598 | 5822 | * - Output 1 and output 2 reset (transition active to inactive) |
mbed_official | 237:f3da66175598 | 5823 | * - Output 1 and output 2 set (transition inactive to active) |
mbed_official | 237:f3da66175598 | 5824 | * - Capture 1 and 2 events |
mbed_official | 237:f3da66175598 | 5825 | * - Timing unit registers update |
mbed_official | 237:f3da66175598 | 5826 | * - Repetition event |
mbed_official | 237:f3da66175598 | 5827 | * - Compare 1 to 4 event |
mbed_official | 237:f3da66175598 | 5828 | * 8 global interrupts are generated for the whole HRTIM: |
mbed_official | 237:f3da66175598 | 5829 | * - System fault and Fault 1 to 5 (regardless of the timing unit attribution) |
mbed_official | 237:f3da66175598 | 5830 | * - DLL calibration done |
mbed_official | 237:f3da66175598 | 5831 | * - Burst mode period completed |
mbed_official | 237:f3da66175598 | 5832 | * |
mbed_official | 237:f3da66175598 | 5833 | @verbatim |
mbed_official | 237:f3da66175598 | 5834 | =============================================================================== |
mbed_official | 237:f3da66175598 | 5835 | ##### HRTIM interrupts handling ##### |
mbed_official | 237:f3da66175598 | 5836 | =============================================================================== |
mbed_official | 237:f3da66175598 | 5837 | [..] |
mbed_official | 237:f3da66175598 | 5838 | This subsection provides a set of functions allowing to manage the HRTIM |
mbed_official | 237:f3da66175598 | 5839 | interrupts |
mbed_official | 237:f3da66175598 | 5840 | (+) HRTIM interrupt handler |
mbed_official | 237:f3da66175598 | 5841 | (+) Callback function called when Fault1 interrupt occurs |
mbed_official | 237:f3da66175598 | 5842 | (+) Callback function called when Fault2 interrupt occurs |
mbed_official | 237:f3da66175598 | 5843 | (+) Callback function called when Fault3 interrupt occurs |
mbed_official | 237:f3da66175598 | 5844 | (+) Callback function called when Fault4 interrupt occurs |
mbed_official | 237:f3da66175598 | 5845 | (+) Callback function called when Fault5 interrupt occurs |
mbed_official | 237:f3da66175598 | 5846 | (+) Callback function called when system Fault interrupt occurs |
mbed_official | 237:f3da66175598 | 5847 | (+) Callback function called when DLL ready interrupt occurs |
mbed_official | 237:f3da66175598 | 5848 | (+) Callback function called when burst mode period interrupt occurs |
mbed_official | 237:f3da66175598 | 5849 | (+) Callback function called when synchronization input interrupt occurs |
mbed_official | 237:f3da66175598 | 5850 | (+) Callback function called when a timer register update interrupt occurs |
mbed_official | 237:f3da66175598 | 5851 | (+) Callback function called when a timer repetition interrupt occurs |
mbed_official | 237:f3da66175598 | 5852 | (+) Callback function called when a compare 1 match interrupt occurs |
mbed_official | 237:f3da66175598 | 5853 | (+) Callback function called when a compare 2 match interrupt occurs |
mbed_official | 237:f3da66175598 | 5854 | (+) Callback function called when a compare 3 match interrupt occurs |
mbed_official | 237:f3da66175598 | 5855 | (+) Callback function called when a compare 4 match interrupt occurs |
mbed_official | 237:f3da66175598 | 5856 | (+) Callback function called when a capture 1 interrupt occurs |
mbed_official | 237:f3da66175598 | 5857 | (+) Callback function called when a capture 2 interrupt occurs |
mbed_official | 237:f3da66175598 | 5858 | (+) Callback function called when a delayed protection interrupt occurs |
mbed_official | 237:f3da66175598 | 5859 | (+) Callback function called when a timer counter reset interrupt occurs |
mbed_official | 237:f3da66175598 | 5860 | (+) Callback function called when a timer output 1 set interrupt occurs |
mbed_official | 237:f3da66175598 | 5861 | (+) Callback function called when a timer output 1 reset interrupt occurs |
mbed_official | 237:f3da66175598 | 5862 | (+) Callback function called when a timer output 2 set interrupt occurs |
mbed_official | 237:f3da66175598 | 5863 | (+) Callback function called when a timer output 2 reset interrupt occurs |
mbed_official | 237:f3da66175598 | 5864 | (+) Callback function called when a timer output 2 reset interrupt occurs |
mbed_official | 237:f3da66175598 | 5865 | (+) Callback function called upon completion of a burst DMA transfer |
mbed_official | 237:f3da66175598 | 5866 | |
mbed_official | 237:f3da66175598 | 5867 | @endverbatim |
mbed_official | 237:f3da66175598 | 5868 | * @{ |
mbed_official | 237:f3da66175598 | 5869 | */ |
mbed_official | 237:f3da66175598 | 5870 | |
mbed_official | 237:f3da66175598 | 5871 | /** |
mbed_official | 237:f3da66175598 | 5872 | * @brief This function handles HRTIM interrupt request. |
mbed_official | 237:f3da66175598 | 5873 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5874 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 5875 | * This parameter can be any value of @ref HRTIM_Timer_Index |
mbed_official | 237:f3da66175598 | 5876 | * @retval None |
mbed_official | 237:f3da66175598 | 5877 | */ |
mbed_official | 237:f3da66175598 | 5878 | void HAL_HRTIM_IRQHandler(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 5879 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 5880 | { |
mbed_official | 237:f3da66175598 | 5881 | /* HRTIM interrupts handling */ |
mbed_official | 237:f3da66175598 | 5882 | if (TimerIdx == HRTIM_TIMERINDEX_COMMON) |
mbed_official | 237:f3da66175598 | 5883 | { |
mbed_official | 237:f3da66175598 | 5884 | HRTIM_HRTIM_ISR(hhrtim); |
mbed_official | 237:f3da66175598 | 5885 | } |
mbed_official | 237:f3da66175598 | 5886 | else if (TimerIdx == HRTIM_TIMERINDEX_MASTER) |
mbed_official | 237:f3da66175598 | 5887 | { |
mbed_official | 237:f3da66175598 | 5888 | /* Master related interrupts handling */ |
mbed_official | 237:f3da66175598 | 5889 | HRTIM_Master_ISR(hhrtim); |
mbed_official | 237:f3da66175598 | 5890 | } |
mbed_official | 237:f3da66175598 | 5891 | else |
mbed_official | 237:f3da66175598 | 5892 | { |
mbed_official | 237:f3da66175598 | 5893 | /* Timing unit related interrupts handling */ |
mbed_official | 237:f3da66175598 | 5894 | HRTIM_Timer_ISR(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 5895 | } |
mbed_official | 237:f3da66175598 | 5896 | |
mbed_official | 237:f3da66175598 | 5897 | } |
mbed_official | 237:f3da66175598 | 5898 | |
mbed_official | 237:f3da66175598 | 5899 | /** |
mbed_official | 237:f3da66175598 | 5900 | * @brief Callback function invoked when a fault 1 interrupt occured |
mbed_official | 237:f3da66175598 | 5901 | * @param hhrtim: pointer to HAL HRTIM handle * @retval None |
mbed_official | 237:f3da66175598 | 5902 | * @retval None |
mbed_official | 237:f3da66175598 | 5903 | */ |
mbed_official | 237:f3da66175598 | 5904 | __weak void HAL_HRTIM_Fault1Callback(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 5905 | { |
mbed_official | 237:f3da66175598 | 5906 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 5907 | the HAL_HRTIM_Fault1Callback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 5908 | */ |
mbed_official | 237:f3da66175598 | 5909 | } |
mbed_official | 237:f3da66175598 | 5910 | |
mbed_official | 237:f3da66175598 | 5911 | /** |
mbed_official | 237:f3da66175598 | 5912 | * @brief Callback function invoked when a fault 2 interrupt occured |
mbed_official | 237:f3da66175598 | 5913 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5914 | * @retval None |
mbed_official | 237:f3da66175598 | 5915 | */ |
mbed_official | 237:f3da66175598 | 5916 | __weak void HAL_HRTIM_Fault2Callback(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 5917 | { |
mbed_official | 237:f3da66175598 | 5918 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 5919 | the HAL_HRTIM_Fault2Callback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 5920 | */ |
mbed_official | 237:f3da66175598 | 5921 | } |
mbed_official | 237:f3da66175598 | 5922 | |
mbed_official | 237:f3da66175598 | 5923 | /** |
mbed_official | 237:f3da66175598 | 5924 | * @brief Callback function invoked when a fault 3 interrupt occured |
mbed_official | 237:f3da66175598 | 5925 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5926 | * @retval None |
mbed_official | 237:f3da66175598 | 5927 | */ |
mbed_official | 237:f3da66175598 | 5928 | __weak void HAL_HRTIM_Fault3Callback(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 5929 | { |
mbed_official | 237:f3da66175598 | 5930 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 5931 | the HAL_HRTIM_Fault3Callback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 5932 | */ |
mbed_official | 237:f3da66175598 | 5933 | } |
mbed_official | 237:f3da66175598 | 5934 | |
mbed_official | 237:f3da66175598 | 5935 | /** |
mbed_official | 237:f3da66175598 | 5936 | * @brief Callback function invoked when a fault 4 interrupt occured |
mbed_official | 237:f3da66175598 | 5937 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5938 | * @retval None |
mbed_official | 237:f3da66175598 | 5939 | */ |
mbed_official | 237:f3da66175598 | 5940 | __weak void HAL_HRTIM_Fault4Callback(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 5941 | { |
mbed_official | 237:f3da66175598 | 5942 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 5943 | the HAL_HRTIM_Fault4Callback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 5944 | */ |
mbed_official | 237:f3da66175598 | 5945 | } |
mbed_official | 237:f3da66175598 | 5946 | |
mbed_official | 237:f3da66175598 | 5947 | /** |
mbed_official | 237:f3da66175598 | 5948 | * @brief Callback function invoked when a fault 5 interrupt occured |
mbed_official | 237:f3da66175598 | 5949 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5950 | * @retval None |
mbed_official | 237:f3da66175598 | 5951 | */ |
mbed_official | 237:f3da66175598 | 5952 | __weak void HAL_HRTIM_Fault5Callback(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 5953 | { |
mbed_official | 237:f3da66175598 | 5954 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 5955 | the HAL_HRTIM_Fault5Callback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 5956 | */ |
mbed_official | 237:f3da66175598 | 5957 | } |
mbed_official | 237:f3da66175598 | 5958 | |
mbed_official | 237:f3da66175598 | 5959 | /** |
mbed_official | 237:f3da66175598 | 5960 | * @brief Callback function invoked when a system fault interrupt occured |
mbed_official | 237:f3da66175598 | 5961 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5962 | * @retval None |
mbed_official | 237:f3da66175598 | 5963 | */ |
mbed_official | 237:f3da66175598 | 5964 | __weak void HAL_HRTIM_SystemFaultCallback(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 5965 | { |
mbed_official | 237:f3da66175598 | 5966 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 5967 | the HAL_HRTIM_SystemFaultCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 5968 | */ |
mbed_official | 237:f3da66175598 | 5969 | } |
mbed_official | 237:f3da66175598 | 5970 | |
mbed_official | 237:f3da66175598 | 5971 | /** |
mbed_official | 237:f3da66175598 | 5972 | * @brief Callback function invoked when a the DLL calibration is completed |
mbed_official | 237:f3da66175598 | 5973 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5974 | * @retval None |
mbed_official | 237:f3da66175598 | 5975 | */ |
mbed_official | 237:f3da66175598 | 5976 | __weak void HAL_HRTIM_DLLCalbrationReadyCallback(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 5977 | { |
mbed_official | 237:f3da66175598 | 5978 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 5979 | the HAL_HRTIM_DLLCalbrationCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 5980 | */ |
mbed_official | 237:f3da66175598 | 5981 | } |
mbed_official | 237:f3da66175598 | 5982 | |
mbed_official | 237:f3da66175598 | 5983 | /** |
mbed_official | 237:f3da66175598 | 5984 | * @brief Callback function invoked when the end of the burst mode period is reached |
mbed_official | 237:f3da66175598 | 5985 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5986 | * @retval None |
mbed_official | 237:f3da66175598 | 5987 | */ |
mbed_official | 237:f3da66175598 | 5988 | __weak void HAL_HRTIM_BurstModePeriodCallback(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 5989 | { |
mbed_official | 237:f3da66175598 | 5990 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 5991 | the HAL_HRTIM_BurstModeCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 5992 | */ |
mbed_official | 237:f3da66175598 | 5993 | } |
mbed_official | 237:f3da66175598 | 5994 | |
mbed_official | 237:f3da66175598 | 5995 | /** |
mbed_official | 237:f3da66175598 | 5996 | * @brief Callback function invoked when a synchronization input event is received |
mbed_official | 237:f3da66175598 | 5997 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 5998 | * @retval None |
mbed_official | 237:f3da66175598 | 5999 | */ |
mbed_official | 237:f3da66175598 | 6000 | __weak void HAL_HRTIM_SynchronizationEventCallback(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 6001 | { |
mbed_official | 237:f3da66175598 | 6002 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6003 | the HAL_HRTIM_Master_SynchronizationEventCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6004 | */ |
mbed_official | 237:f3da66175598 | 6005 | } |
mbed_official | 237:f3da66175598 | 6006 | |
mbed_official | 237:f3da66175598 | 6007 | /** |
mbed_official | 237:f3da66175598 | 6008 | * @brief Callback function invoked when timer registers are updated |
mbed_official | 237:f3da66175598 | 6009 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6010 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6011 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6012 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 6013 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6014 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6015 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6016 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6017 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6018 | * @retval None |
mbed_official | 237:f3da66175598 | 6019 | */ |
mbed_official | 237:f3da66175598 | 6020 | __weak void HAL_HRTIM_RegistersUpdateCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6021 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6022 | { |
mbed_official | 237:f3da66175598 | 6023 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6024 | the HAL_HRTIM_Master_RegistersUpdateCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6025 | */ |
mbed_official | 237:f3da66175598 | 6026 | } |
mbed_official | 237:f3da66175598 | 6027 | |
mbed_official | 237:f3da66175598 | 6028 | /** |
mbed_official | 237:f3da66175598 | 6029 | * @brief Callback function invoked when timer repetition period has elapsed |
mbed_official | 237:f3da66175598 | 6030 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6031 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6032 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6033 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 6034 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6035 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6036 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6037 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6038 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6039 | * @retval None |
mbed_official | 237:f3da66175598 | 6040 | */ |
mbed_official | 237:f3da66175598 | 6041 | __weak void HAL_HRTIM_RepetitionEventCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6042 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6043 | { |
mbed_official | 237:f3da66175598 | 6044 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6045 | the HAL_HRTIM_Master_RepetitionEventCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6046 | */ |
mbed_official | 237:f3da66175598 | 6047 | } |
mbed_official | 237:f3da66175598 | 6048 | |
mbed_official | 237:f3da66175598 | 6049 | /** |
mbed_official | 237:f3da66175598 | 6050 | * @brief Callback function invoked when the timer counter matches the value |
mbed_official | 237:f3da66175598 | 6051 | * programmed in the compare 1 register |
mbed_official | 237:f3da66175598 | 6052 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6053 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6054 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6055 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 6056 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6057 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6058 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6059 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6060 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6061 | * @retval None |
mbed_official | 237:f3da66175598 | 6062 | */ |
mbed_official | 237:f3da66175598 | 6063 | __weak void HAL_HRTIM_Compare1EventCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6064 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6065 | { |
mbed_official | 237:f3da66175598 | 6066 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6067 | the HAL_HRTIM_Master_Compare1EventCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6068 | */ |
mbed_official | 237:f3da66175598 | 6069 | } |
mbed_official | 237:f3da66175598 | 6070 | |
mbed_official | 237:f3da66175598 | 6071 | /** |
mbed_official | 237:f3da66175598 | 6072 | * @brief Callback function invoked when the timer counter matches the value |
mbed_official | 237:f3da66175598 | 6073 | * programmed in the compare 2 register |
mbed_official | 237:f3da66175598 | 6074 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6075 | * @retval None |
mbed_official | 237:f3da66175598 | 6076 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6077 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6078 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 6079 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6080 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6081 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6082 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6083 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6084 | */ |
mbed_official | 237:f3da66175598 | 6085 | __weak void HAL_HRTIM_Compare2EventCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6086 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6087 | { |
mbed_official | 237:f3da66175598 | 6088 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6089 | the HAL_HRTIM_Master_Compare2EventCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6090 | */ |
mbed_official | 237:f3da66175598 | 6091 | } |
mbed_official | 237:f3da66175598 | 6092 | |
mbed_official | 237:f3da66175598 | 6093 | /** |
mbed_official | 237:f3da66175598 | 6094 | * @brief Callback function invoked when the timer counter matches the value |
mbed_official | 237:f3da66175598 | 6095 | * programmed in the compare 3 register |
mbed_official | 237:f3da66175598 | 6096 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6097 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6098 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6099 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 6100 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6101 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6102 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6103 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6104 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6105 | * @retval None |
mbed_official | 237:f3da66175598 | 6106 | */ |
mbed_official | 237:f3da66175598 | 6107 | __weak void HAL_HRTIM_Compare3EventCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6108 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6109 | { |
mbed_official | 237:f3da66175598 | 6110 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6111 | the HAL_HRTIM_Master_Compare3EventCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6112 | */ |
mbed_official | 237:f3da66175598 | 6113 | } |
mbed_official | 237:f3da66175598 | 6114 | |
mbed_official | 237:f3da66175598 | 6115 | /** |
mbed_official | 237:f3da66175598 | 6116 | * @brief Callback function invoked when the timer counter matches the value |
mbed_official | 237:f3da66175598 | 6117 | * programmed in the compare 4 register |
mbed_official | 237:f3da66175598 | 6118 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6119 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6120 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6121 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 6122 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6123 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6124 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6125 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6126 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6127 | * @retval None |
mbed_official | 237:f3da66175598 | 6128 | */ |
mbed_official | 237:f3da66175598 | 6129 | __weak void HAL_HRTIM_Compare4EventCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6130 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6131 | { |
mbed_official | 237:f3da66175598 | 6132 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6133 | the HAL_HRTIM_Master_Compare4EventCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6134 | */ |
mbed_official | 237:f3da66175598 | 6135 | } |
mbed_official | 237:f3da66175598 | 6136 | |
mbed_official | 237:f3da66175598 | 6137 | /** |
mbed_official | 237:f3da66175598 | 6138 | * @brief Callback function invoked when the timer x capture 1 event occurs |
mbed_official | 237:f3da66175598 | 6139 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6140 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6141 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6142 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6143 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6144 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6145 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6146 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6147 | * @retval None |
mbed_official | 237:f3da66175598 | 6148 | */ |
mbed_official | 237:f3da66175598 | 6149 | __weak void HAL_HRTIM_Capture1EventCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6150 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6151 | { |
mbed_official | 237:f3da66175598 | 6152 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6153 | the HAL_HRTIM_Timer_Capture1EventCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6154 | */ |
mbed_official | 237:f3da66175598 | 6155 | } |
mbed_official | 237:f3da66175598 | 6156 | |
mbed_official | 237:f3da66175598 | 6157 | /** |
mbed_official | 237:f3da66175598 | 6158 | * @brief Callback function invoked when the timer x capture 2 event occurs |
mbed_official | 237:f3da66175598 | 6159 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6160 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6161 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6162 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6163 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6164 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6165 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6166 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6167 | * @retval None |
mbed_official | 237:f3da66175598 | 6168 | */ |
mbed_official | 237:f3da66175598 | 6169 | __weak void HAL_HRTIM_Capture2EventCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6170 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6171 | { |
mbed_official | 237:f3da66175598 | 6172 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6173 | the HAL_HRTIM_Timer_Capture2EventCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6174 | */ |
mbed_official | 237:f3da66175598 | 6175 | } |
mbed_official | 237:f3da66175598 | 6176 | |
mbed_official | 237:f3da66175598 | 6177 | /** |
mbed_official | 237:f3da66175598 | 6178 | * @brief Callback function invoked when the delayed idle or balanced idle mode is |
mbed_official | 237:f3da66175598 | 6179 | * entered |
mbed_official | 237:f3da66175598 | 6180 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6181 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6182 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6183 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6184 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6185 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6186 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6187 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6188 | * @retval None |
mbed_official | 237:f3da66175598 | 6189 | */ |
mbed_official | 237:f3da66175598 | 6190 | __weak void HAL_HRTIM_DelayedProtectionCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6191 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6192 | { |
mbed_official | 237:f3da66175598 | 6193 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6194 | the HAL_HRTIM_Timer_DelayedProtectionCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6195 | */ |
mbed_official | 237:f3da66175598 | 6196 | } |
mbed_official | 237:f3da66175598 | 6197 | |
mbed_official | 237:f3da66175598 | 6198 | /** |
mbed_official | 237:f3da66175598 | 6199 | * @brief Callback function invoked when the timer x counter reset/roll-over |
mbed_official | 237:f3da66175598 | 6200 | * event occurs |
mbed_official | 237:f3da66175598 | 6201 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6202 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6203 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6204 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6205 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6206 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6207 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6208 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6209 | * @retval None |
mbed_official | 237:f3da66175598 | 6210 | */ |
mbed_official | 237:f3da66175598 | 6211 | __weak void HAL_HRTIM_CounterResetCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6212 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6213 | { |
mbed_official | 237:f3da66175598 | 6214 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6215 | the HAL_HRTIM_Timer_CounterResetCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6216 | */ |
mbed_official | 237:f3da66175598 | 6217 | } |
mbed_official | 237:f3da66175598 | 6218 | |
mbed_official | 237:f3da66175598 | 6219 | /** |
mbed_official | 237:f3da66175598 | 6220 | * @brief Callback function invoked when the timer x output 1 is set |
mbed_official | 237:f3da66175598 | 6221 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6222 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6223 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6224 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6225 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6226 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6227 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6228 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6229 | * @retval None |
mbed_official | 237:f3da66175598 | 6230 | */ |
mbed_official | 237:f3da66175598 | 6231 | __weak void HAL_HRTIM_Output1SetCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6232 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6233 | { |
mbed_official | 237:f3da66175598 | 6234 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6235 | the HAL_HRTIM_Timer_Output1SetCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6236 | */ |
mbed_official | 237:f3da66175598 | 6237 | } |
mbed_official | 237:f3da66175598 | 6238 | |
mbed_official | 237:f3da66175598 | 6239 | /** |
mbed_official | 237:f3da66175598 | 6240 | * @brief Callback function invoked when the timer x output 1 is reset |
mbed_official | 237:f3da66175598 | 6241 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6242 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6243 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6244 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6245 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6246 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6247 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6248 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6249 | * @retval None |
mbed_official | 237:f3da66175598 | 6250 | */ |
mbed_official | 237:f3da66175598 | 6251 | __weak void HAL_HRTIM_Output1ResetCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6252 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6253 | { |
mbed_official | 237:f3da66175598 | 6254 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6255 | the HAL_HRTIM_Timer_Output1ResetCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6256 | */ |
mbed_official | 237:f3da66175598 | 6257 | } |
mbed_official | 237:f3da66175598 | 6258 | |
mbed_official | 237:f3da66175598 | 6259 | /** |
mbed_official | 237:f3da66175598 | 6260 | * @brief Callback function invoked when the timer x output 2 is set |
mbed_official | 237:f3da66175598 | 6261 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6262 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6263 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6264 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6265 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6266 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6267 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6268 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6269 | * @retval None |
mbed_official | 237:f3da66175598 | 6270 | */ |
mbed_official | 237:f3da66175598 | 6271 | __weak void HAL_HRTIM_Output2SetCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6272 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6273 | { |
mbed_official | 237:f3da66175598 | 6274 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6275 | the HAL_HRTIM_Timer_Output2SetCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6276 | */ |
mbed_official | 237:f3da66175598 | 6277 | } |
mbed_official | 237:f3da66175598 | 6278 | |
mbed_official | 237:f3da66175598 | 6279 | /** |
mbed_official | 237:f3da66175598 | 6280 | * @brief Callback function invoked when the timer x output 2 is reset |
mbed_official | 237:f3da66175598 | 6281 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6282 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6283 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6284 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6285 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6286 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6287 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6288 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6289 | * @retval None |
mbed_official | 237:f3da66175598 | 6290 | */ |
mbed_official | 237:f3da66175598 | 6291 | __weak void HAL_HRTIM_Output2ResetCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6292 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6293 | { |
mbed_official | 237:f3da66175598 | 6294 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6295 | the HAL_HRTIM_Timer_Output2ResetCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6296 | */ |
mbed_official | 237:f3da66175598 | 6297 | } |
mbed_official | 237:f3da66175598 | 6298 | |
mbed_official | 237:f3da66175598 | 6299 | /** |
mbed_official | 237:f3da66175598 | 6300 | * @brief Callback function invoked when a DMA burst transfer is completed |
mbed_official | 237:f3da66175598 | 6301 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6302 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6303 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 6304 | * @arg HRTIM_TIMERINDEX_MASTER for master timer |
mbed_official | 237:f3da66175598 | 6305 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 6306 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 6307 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 6308 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 6309 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 6310 | * @retval None |
mbed_official | 237:f3da66175598 | 6311 | */ |
mbed_official | 237:f3da66175598 | 6312 | __weak void HAL_HRTIM_BurstDMATransferCallback(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6313 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 6314 | { |
mbed_official | 237:f3da66175598 | 6315 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6316 | the HAL_HRTIM_BurstDMATransferCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6317 | */ |
mbed_official | 237:f3da66175598 | 6318 | } |
mbed_official | 237:f3da66175598 | 6319 | |
mbed_official | 237:f3da66175598 | 6320 | /** |
mbed_official | 237:f3da66175598 | 6321 | * @brief Callback function invoked when a DMA error occurs |
mbed_official | 237:f3da66175598 | 6322 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6323 | * @retval None |
mbed_official | 237:f3da66175598 | 6324 | */ |
mbed_official | 237:f3da66175598 | 6325 | __weak void HAL_HRTIM_ErrorCallback(HRTIM_HandleTypeDef *hhrtim) |
mbed_official | 237:f3da66175598 | 6326 | { |
mbed_official | 237:f3da66175598 | 6327 | /* NOTE : This function should not be modified, when the callback is needed, |
mbed_official | 237:f3da66175598 | 6328 | the HAL_HRTIM_ErrorCallback could be implenetd in the user file |
mbed_official | 237:f3da66175598 | 6329 | */ |
mbed_official | 237:f3da66175598 | 6330 | } |
mbed_official | 237:f3da66175598 | 6331 | |
mbed_official | 237:f3da66175598 | 6332 | /** |
mbed_official | 237:f3da66175598 | 6333 | * @} |
mbed_official | 237:f3da66175598 | 6334 | */ |
mbed_official | 237:f3da66175598 | 6335 | |
mbed_official | 237:f3da66175598 | 6336 | /** |
mbed_official | 237:f3da66175598 | 6337 | * @brief Configures the master timer time base |
mbed_official | 237:f3da66175598 | 6338 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6339 | * @param pTimeBaseCfg: pointer to the time base configuration structure |
mbed_official | 237:f3da66175598 | 6340 | * @retval None |
mbed_official | 237:f3da66175598 | 6341 | */ |
mbed_official | 237:f3da66175598 | 6342 | static void HRTIM_MasterBase_Config(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6343 | HRTIM_TimeBaseCfgTypeDef * pTimeBaseCfg) |
mbed_official | 237:f3da66175598 | 6344 | { |
mbed_official | 237:f3da66175598 | 6345 | uint32_t hrtim_mcr; |
mbed_official | 237:f3da66175598 | 6346 | |
mbed_official | 237:f3da66175598 | 6347 | /* Configure master timer */ |
mbed_official | 237:f3da66175598 | 6348 | hrtim_mcr = hhrtim->Instance->sMasterRegs.MCR; |
mbed_official | 237:f3da66175598 | 6349 | |
mbed_official | 237:f3da66175598 | 6350 | /* Set the prescaler ratio */ |
mbed_official | 237:f3da66175598 | 6351 | hrtim_mcr &= (uint32_t) ~(HRTIM_MCR_CK_PSC); |
mbed_official | 237:f3da66175598 | 6352 | hrtim_mcr |= (uint32_t)pTimeBaseCfg->PrescalerRatio; |
mbed_official | 237:f3da66175598 | 6353 | |
mbed_official | 237:f3da66175598 | 6354 | /* Set the operating mode */ |
mbed_official | 237:f3da66175598 | 6355 | hrtim_mcr &= (uint32_t) ~(HRTIM_MCR_CONT | HRTIM_MCR_RETRIG); |
mbed_official | 237:f3da66175598 | 6356 | hrtim_mcr |= (uint32_t)pTimeBaseCfg->Mode; |
mbed_official | 237:f3da66175598 | 6357 | |
mbed_official | 237:f3da66175598 | 6358 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 6359 | hhrtim->Instance->sMasterRegs.MCR = hrtim_mcr; |
mbed_official | 237:f3da66175598 | 6360 | hhrtim->Instance->sMasterRegs.MPER = pTimeBaseCfg->Period; |
mbed_official | 237:f3da66175598 | 6361 | hhrtim->Instance->sMasterRegs.MREP = pTimeBaseCfg->RepetitionCounter; |
mbed_official | 237:f3da66175598 | 6362 | } |
mbed_official | 237:f3da66175598 | 6363 | |
mbed_official | 237:f3da66175598 | 6364 | /** |
mbed_official | 237:f3da66175598 | 6365 | * @brief Configures timing unit (timer A to timer E) time base |
mbed_official | 237:f3da66175598 | 6366 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6367 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6368 | * @param pTimeBaseCfg: pointer to the time base configuration structure |
mbed_official | 237:f3da66175598 | 6369 | * @retval None |
mbed_official | 237:f3da66175598 | 6370 | */ |
mbed_official | 237:f3da66175598 | 6371 | static void HRTIM_TimingUnitBase_Config(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6372 | uint32_t TimerIdx , |
mbed_official | 237:f3da66175598 | 6373 | HRTIM_TimeBaseCfgTypeDef * pTimeBaseCfg) |
mbed_official | 237:f3da66175598 | 6374 | { |
mbed_official | 237:f3da66175598 | 6375 | uint32_t hrtim_timcr; |
mbed_official | 237:f3da66175598 | 6376 | |
mbed_official | 237:f3da66175598 | 6377 | /* Configure master timing unit */ |
mbed_official | 237:f3da66175598 | 6378 | hrtim_timcr = hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxCR; |
mbed_official | 237:f3da66175598 | 6379 | |
mbed_official | 237:f3da66175598 | 6380 | /* Set the prescaler ratio */ |
mbed_official | 237:f3da66175598 | 6381 | hrtim_timcr &= (uint32_t) ~(HRTIM_TIMCR_CK_PSC); |
mbed_official | 237:f3da66175598 | 6382 | hrtim_timcr |= (uint32_t)pTimeBaseCfg->PrescalerRatio; |
mbed_official | 237:f3da66175598 | 6383 | |
mbed_official | 237:f3da66175598 | 6384 | /* Set the operating mode */ |
mbed_official | 237:f3da66175598 | 6385 | hrtim_timcr &= (uint32_t) ~(HRTIM_TIMCR_CONT | HRTIM_TIMCR_RETRIG); |
mbed_official | 237:f3da66175598 | 6386 | hrtim_timcr |= (uint32_t)pTimeBaseCfg->Mode; |
mbed_official | 237:f3da66175598 | 6387 | |
mbed_official | 237:f3da66175598 | 6388 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 6389 | hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxCR = hrtim_timcr; |
mbed_official | 237:f3da66175598 | 6390 | hhrtim->Instance->sTimerxRegs[TimerIdx].PERxR = pTimeBaseCfg->Period; |
mbed_official | 237:f3da66175598 | 6391 | hhrtim->Instance->sTimerxRegs[TimerIdx].REPxR = pTimeBaseCfg->RepetitionCounter; |
mbed_official | 237:f3da66175598 | 6392 | } |
mbed_official | 237:f3da66175598 | 6393 | |
mbed_official | 237:f3da66175598 | 6394 | /** |
mbed_official | 237:f3da66175598 | 6395 | * @brief Configures the master timer in waveform mode |
mbed_official | 237:f3da66175598 | 6396 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6397 | * @param pTimerCfg: pointer to the timer configuration data structure |
mbed_official | 237:f3da66175598 | 6398 | * @retval None |
mbed_official | 237:f3da66175598 | 6399 | */ |
mbed_official | 237:f3da66175598 | 6400 | static void HRTIM_MasterWaveform_Config(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6401 | HRTIM_TimerCfgTypeDef * pTimerCfg) |
mbed_official | 237:f3da66175598 | 6402 | { |
mbed_official | 237:f3da66175598 | 6403 | uint32_t hrtim_mcr; |
mbed_official | 237:f3da66175598 | 6404 | uint32_t hrtim_bmcr; |
mbed_official | 237:f3da66175598 | 6405 | |
mbed_official | 237:f3da66175598 | 6406 | /* Configure master timer */ |
mbed_official | 237:f3da66175598 | 6407 | hrtim_mcr = hhrtim->Instance->sMasterRegs.MCR; |
mbed_official | 237:f3da66175598 | 6408 | hrtim_bmcr = hhrtim->Instance->sCommonRegs.BMCR; |
mbed_official | 237:f3da66175598 | 6409 | |
mbed_official | 237:f3da66175598 | 6410 | /* Enable/Disable the half mode */ |
mbed_official | 237:f3da66175598 | 6411 | hrtim_mcr &= ~(HRTIM_MCR_HALF); |
mbed_official | 237:f3da66175598 | 6412 | hrtim_mcr |= pTimerCfg->HalfModeEnable; |
mbed_official | 237:f3da66175598 | 6413 | |
mbed_official | 237:f3da66175598 | 6414 | /* Enable/Disable the timer start upon synchronization event reception */ |
mbed_official | 237:f3da66175598 | 6415 | hrtim_mcr &= ~(HRTIM_MCR_SYNCSTRTM); |
mbed_official | 237:f3da66175598 | 6416 | hrtim_mcr |= pTimerCfg->StartOnSync; |
mbed_official | 237:f3da66175598 | 6417 | |
mbed_official | 237:f3da66175598 | 6418 | /* Enable/Disable the timer reset upon synchronization event reception */ |
mbed_official | 237:f3da66175598 | 6419 | hrtim_mcr &= ~(HRTIM_MCR_SYNCRSTM); |
mbed_official | 237:f3da66175598 | 6420 | hrtim_mcr |= pTimerCfg->ResetOnSync; |
mbed_official | 237:f3da66175598 | 6421 | |
mbed_official | 237:f3da66175598 | 6422 | /* Enable/Disable the DAC synchronization event generation */ |
mbed_official | 237:f3da66175598 | 6423 | hrtim_mcr &= ~(HRTIM_MCR_DACSYNC); |
mbed_official | 237:f3da66175598 | 6424 | hrtim_mcr |= pTimerCfg->DACSynchro; |
mbed_official | 237:f3da66175598 | 6425 | |
mbed_official | 237:f3da66175598 | 6426 | /* Enable/Disable preload meachanism for timer registers */ |
mbed_official | 237:f3da66175598 | 6427 | hrtim_mcr &= ~(HRTIM_MCR_PREEN); |
mbed_official | 237:f3da66175598 | 6428 | hrtim_mcr |= pTimerCfg->PreloadEnable; |
mbed_official | 237:f3da66175598 | 6429 | |
mbed_official | 237:f3da66175598 | 6430 | /* Master timer registers update handling */ |
mbed_official | 237:f3da66175598 | 6431 | hrtim_mcr &= ~(HRTIM_MCR_BRSTDMA); |
mbed_official | 237:f3da66175598 | 6432 | hrtim_mcr |= (pTimerCfg->UpdateGating << 2); |
mbed_official | 237:f3da66175598 | 6433 | |
mbed_official | 237:f3da66175598 | 6434 | /* Enable/Disable registers update on repetition */ |
mbed_official | 237:f3da66175598 | 6435 | hrtim_mcr &= ~(HRTIM_MCR_MREPU); |
mbed_official | 237:f3da66175598 | 6436 | hrtim_mcr |= pTimerCfg->RepetitionUpdate; |
mbed_official | 237:f3da66175598 | 6437 | |
mbed_official | 237:f3da66175598 | 6438 | /* Set the timer burst mode */ |
mbed_official | 237:f3da66175598 | 6439 | hrtim_bmcr &= ~(HRTIM_BMCR_MTBM); |
mbed_official | 237:f3da66175598 | 6440 | hrtim_bmcr |= pTimerCfg->BurstMode; |
mbed_official | 237:f3da66175598 | 6441 | |
mbed_official | 237:f3da66175598 | 6442 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 6443 | hhrtim->Instance->sMasterRegs.MCR = hrtim_mcr; |
mbed_official | 237:f3da66175598 | 6444 | hhrtim->Instance->sCommonRegs.BMCR = hrtim_bmcr; |
mbed_official | 237:f3da66175598 | 6445 | } |
mbed_official | 237:f3da66175598 | 6446 | |
mbed_official | 237:f3da66175598 | 6447 | /** |
mbed_official | 237:f3da66175598 | 6448 | * @brief Configures timing unit (timer A to timer E) in waveform mode |
mbed_official | 237:f3da66175598 | 6449 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6450 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6451 | * @param pTimerCfg: pointer to the timer configuration data structure |
mbed_official | 237:f3da66175598 | 6452 | * @retval None |
mbed_official | 237:f3da66175598 | 6453 | */ |
mbed_official | 237:f3da66175598 | 6454 | static void HRTIM_TimingUnitWaveform_Config(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6455 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 6456 | HRTIM_TimerCfgTypeDef * pTimerCfg) |
mbed_official | 237:f3da66175598 | 6457 | { |
mbed_official | 237:f3da66175598 | 6458 | uint32_t hrtim_timcr; |
mbed_official | 237:f3da66175598 | 6459 | uint32_t hrtim_timfltr; |
mbed_official | 237:f3da66175598 | 6460 | uint32_t hrtim_timoutr; |
mbed_official | 237:f3da66175598 | 6461 | uint32_t hrtim_timrstr; |
mbed_official | 237:f3da66175598 | 6462 | uint32_t hrtim_bmcr; |
mbed_official | 237:f3da66175598 | 6463 | |
mbed_official | 237:f3da66175598 | 6464 | /* UPDGAT bitfield must be reset before programming a new value */ |
mbed_official | 237:f3da66175598 | 6465 | hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxCR &= ~(HRTIM_TIMCR_UPDGAT); |
mbed_official | 237:f3da66175598 | 6466 | |
mbed_official | 237:f3da66175598 | 6467 | /* Configure timing unit (Timer A to Timer E) */ |
mbed_official | 237:f3da66175598 | 6468 | hrtim_timcr = hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxCR; |
mbed_official | 237:f3da66175598 | 6469 | hrtim_timfltr = hhrtim->Instance->sTimerxRegs[TimerIdx].FLTxR; |
mbed_official | 237:f3da66175598 | 6470 | hrtim_timoutr = hhrtim->Instance->sTimerxRegs[TimerIdx].OUTxR; |
mbed_official | 237:f3da66175598 | 6471 | hrtim_timrstr = hhrtim->Instance->sTimerxRegs[TimerIdx].RSTxR; |
mbed_official | 237:f3da66175598 | 6472 | hrtim_bmcr = hhrtim->Instance->sCommonRegs.BMCR; |
mbed_official | 237:f3da66175598 | 6473 | |
mbed_official | 237:f3da66175598 | 6474 | /* Enable/Disable the half mode */ |
mbed_official | 237:f3da66175598 | 6475 | hrtim_timcr &= ~(HRTIM_TIMCR_HALF); |
mbed_official | 237:f3da66175598 | 6476 | hrtim_timcr |= pTimerCfg->HalfModeEnable; |
mbed_official | 237:f3da66175598 | 6477 | |
mbed_official | 237:f3da66175598 | 6478 | /* Enable/Disable the timer start upon synchronization event reception */ |
mbed_official | 237:f3da66175598 | 6479 | hrtim_timcr &= ~(HRTIM_TIMCR_SYNCSTRT); |
mbed_official | 237:f3da66175598 | 6480 | hrtim_timcr |= pTimerCfg->StartOnSync; |
mbed_official | 237:f3da66175598 | 6481 | |
mbed_official | 237:f3da66175598 | 6482 | /* Enable/Disable the timer reset upon synchronization event reception */ |
mbed_official | 237:f3da66175598 | 6483 | hrtim_timcr &= ~(HRTIM_TIMCR_SYNCRST); |
mbed_official | 237:f3da66175598 | 6484 | hrtim_timcr |= pTimerCfg->ResetOnSync; |
mbed_official | 237:f3da66175598 | 6485 | |
mbed_official | 237:f3da66175598 | 6486 | /* Enable/Disable the DAC synchronization event generation */ |
mbed_official | 237:f3da66175598 | 6487 | hrtim_timcr &= ~(HRTIM_TIMCR_DACSYNC); |
mbed_official | 237:f3da66175598 | 6488 | hrtim_timcr |= pTimerCfg->DACSynchro; |
mbed_official | 237:f3da66175598 | 6489 | |
mbed_official | 237:f3da66175598 | 6490 | /* Enable/Disable preload meachanism for timer registers */ |
mbed_official | 237:f3da66175598 | 6491 | hrtim_timcr &= ~(HRTIM_TIMCR_PREEN); |
mbed_official | 237:f3da66175598 | 6492 | hrtim_timcr |= pTimerCfg->PreloadEnable; |
mbed_official | 237:f3da66175598 | 6493 | |
mbed_official | 237:f3da66175598 | 6494 | /* Timing unit registers update handling */ |
mbed_official | 237:f3da66175598 | 6495 | hrtim_timcr &= ~(HRTIM_TIMCR_UPDGAT); |
mbed_official | 237:f3da66175598 | 6496 | hrtim_timcr |= pTimerCfg->UpdateGating; |
mbed_official | 237:f3da66175598 | 6497 | |
mbed_official | 237:f3da66175598 | 6498 | /* Enable/Disable registers update on repetition */ |
mbed_official | 237:f3da66175598 | 6499 | hrtim_timcr &= ~(HRTIM_TIMCR_TREPU); |
mbed_official | 237:f3da66175598 | 6500 | if (pTimerCfg->RepetitionUpdate == HRTIM_UPDATEONREPETITION_ENABLED) |
mbed_official | 237:f3da66175598 | 6501 | { |
mbed_official | 237:f3da66175598 | 6502 | hrtim_timcr |= HRTIM_TIMCR_TREPU; |
mbed_official | 237:f3da66175598 | 6503 | } |
mbed_official | 237:f3da66175598 | 6504 | |
mbed_official | 237:f3da66175598 | 6505 | /* Set the push-pull mode */ |
mbed_official | 237:f3da66175598 | 6506 | hrtim_timcr &= ~(HRTIM_TIMCR_PSHPLL); |
mbed_official | 237:f3da66175598 | 6507 | hrtim_timcr |= pTimerCfg->PushPull; |
mbed_official | 237:f3da66175598 | 6508 | |
mbed_official | 237:f3da66175598 | 6509 | /* Enable/Disable registers update on timer counter reset */ |
mbed_official | 237:f3da66175598 | 6510 | hrtim_timcr &= ~(HRTIM_TIMCR_TRSTU); |
mbed_official | 237:f3da66175598 | 6511 | hrtim_timcr |= pTimerCfg->ResetUpdate; |
mbed_official | 237:f3da66175598 | 6512 | |
mbed_official | 237:f3da66175598 | 6513 | /* Set the timer update trigger */ |
mbed_official | 237:f3da66175598 | 6514 | hrtim_timcr &= ~(HRTIM_TIMCR_TIMUPDATETRIGGER); |
mbed_official | 237:f3da66175598 | 6515 | hrtim_timcr |= pTimerCfg->UpdateTrigger; |
mbed_official | 237:f3da66175598 | 6516 | |
mbed_official | 237:f3da66175598 | 6517 | |
mbed_official | 237:f3da66175598 | 6518 | /* Enable/Disable the fault channel at timer level */ |
mbed_official | 237:f3da66175598 | 6519 | hrtim_timfltr &= ~(HRTIM_FLTR_FLTxEN); |
mbed_official | 237:f3da66175598 | 6520 | hrtim_timfltr |= (pTimerCfg->FaultEnable & HRTIM_FLTR_FLTxEN); |
mbed_official | 237:f3da66175598 | 6521 | |
mbed_official | 237:f3da66175598 | 6522 | /* Lock/Unlock fault sources at timer level */ |
mbed_official | 237:f3da66175598 | 6523 | hrtim_timfltr &= ~(HRTIM_FLTR_FLTLCK); |
mbed_official | 237:f3da66175598 | 6524 | hrtim_timfltr |= pTimerCfg->FaultLock; |
mbed_official | 237:f3da66175598 | 6525 | |
mbed_official | 237:f3da66175598 | 6526 | /* The deadtime cannot be used simultaneously with the push-pull mode */ |
mbed_official | 237:f3da66175598 | 6527 | if (pTimerCfg->PushPull == HRTIM_TIMPUSHPULLMODE_DISABLED) |
mbed_official | 237:f3da66175598 | 6528 | { |
mbed_official | 237:f3da66175598 | 6529 | /* Enable/Disable dead time insertion at timer level */ |
mbed_official | 237:f3da66175598 | 6530 | hrtim_timoutr &= ~(HRTIM_OUTR_DTEN); |
mbed_official | 237:f3da66175598 | 6531 | hrtim_timoutr |= pTimerCfg->DeadTimeInsertion; |
mbed_official | 237:f3da66175598 | 6532 | } |
mbed_official | 237:f3da66175598 | 6533 | |
mbed_official | 237:f3da66175598 | 6534 | /* Enable/Disable delayed protection at timer level |
mbed_official | 237:f3da66175598 | 6535 | Delayed Idle is available whatever the timer operating mode (regular, push-pull) |
mbed_official | 237:f3da66175598 | 6536 | Balanced Idle is only available in push-pull mode |
mbed_official | 237:f3da66175598 | 6537 | */ |
mbed_official | 237:f3da66175598 | 6538 | if ( ((pTimerCfg->DelayedProtectionMode != HRTIM_TIMDELAYEDPROTECTION_BALANCED_EEV68) |
mbed_official | 237:f3da66175598 | 6539 | && (pTimerCfg->DelayedProtectionMode != HRTIM_TIMDELAYEDPROTECTION_BALANCED_EEV79)) |
mbed_official | 237:f3da66175598 | 6540 | || (pTimerCfg->PushPull == HRTIM_TIMPUSHPULLMODE_ENABLED)) |
mbed_official | 237:f3da66175598 | 6541 | { |
mbed_official | 237:f3da66175598 | 6542 | hrtim_timoutr &= ~(HRTIM_OUTR_DLYPRT| HRTIM_OUTR_DLYPRTEN); |
mbed_official | 237:f3da66175598 | 6543 | hrtim_timoutr |= pTimerCfg->DelayedProtectionMode; |
mbed_official | 237:f3da66175598 | 6544 | } |
mbed_official | 237:f3da66175598 | 6545 | |
mbed_official | 237:f3da66175598 | 6546 | /* Set the timer counter reset trigger */ |
mbed_official | 237:f3da66175598 | 6547 | hrtim_timrstr = pTimerCfg->ResetTrigger; |
mbed_official | 237:f3da66175598 | 6548 | |
mbed_official | 237:f3da66175598 | 6549 | /* Set the timer burst mode */ |
mbed_official | 237:f3da66175598 | 6550 | switch (TimerIdx) |
mbed_official | 237:f3da66175598 | 6551 | { |
mbed_official | 237:f3da66175598 | 6552 | case HRTIM_TIMERINDEX_TIMER_A: |
mbed_official | 237:f3da66175598 | 6553 | { |
mbed_official | 237:f3da66175598 | 6554 | hrtim_bmcr &= ~(HRTIM_BMCR_TABM); |
mbed_official | 237:f3da66175598 | 6555 | hrtim_bmcr |= ( pTimerCfg->BurstMode << 1); |
mbed_official | 237:f3da66175598 | 6556 | } |
mbed_official | 237:f3da66175598 | 6557 | break; |
mbed_official | 237:f3da66175598 | 6558 | case HRTIM_TIMERINDEX_TIMER_B: |
mbed_official | 237:f3da66175598 | 6559 | { |
mbed_official | 237:f3da66175598 | 6560 | hrtim_bmcr &= ~(HRTIM_BMCR_TBBM); |
mbed_official | 237:f3da66175598 | 6561 | hrtim_bmcr |= ( pTimerCfg->BurstMode << 2); |
mbed_official | 237:f3da66175598 | 6562 | } |
mbed_official | 237:f3da66175598 | 6563 | break; |
mbed_official | 237:f3da66175598 | 6564 | case HRTIM_TIMERINDEX_TIMER_C: |
mbed_official | 237:f3da66175598 | 6565 | { |
mbed_official | 237:f3da66175598 | 6566 | hrtim_bmcr &= ~(HRTIM_BMCR_TCBM); |
mbed_official | 237:f3da66175598 | 6567 | hrtim_bmcr |= ( pTimerCfg->BurstMode << 3); |
mbed_official | 237:f3da66175598 | 6568 | } |
mbed_official | 237:f3da66175598 | 6569 | break; |
mbed_official | 237:f3da66175598 | 6570 | case HRTIM_TIMERINDEX_TIMER_D: |
mbed_official | 237:f3da66175598 | 6571 | { |
mbed_official | 237:f3da66175598 | 6572 | hrtim_bmcr &= ~(HRTIM_BMCR_TDBM); |
mbed_official | 237:f3da66175598 | 6573 | hrtim_bmcr |= ( pTimerCfg->BurstMode << 4); |
mbed_official | 237:f3da66175598 | 6574 | } |
mbed_official | 237:f3da66175598 | 6575 | break; |
mbed_official | 237:f3da66175598 | 6576 | case HRTIM_TIMERINDEX_TIMER_E: |
mbed_official | 237:f3da66175598 | 6577 | { |
mbed_official | 237:f3da66175598 | 6578 | hrtim_bmcr &= ~(HRTIM_BMCR_TEBM); |
mbed_official | 237:f3da66175598 | 6579 | hrtim_bmcr |= ( pTimerCfg->BurstMode << 5); |
mbed_official | 237:f3da66175598 | 6580 | } |
mbed_official | 237:f3da66175598 | 6581 | break; |
mbed_official | 237:f3da66175598 | 6582 | } |
mbed_official | 237:f3da66175598 | 6583 | |
mbed_official | 237:f3da66175598 | 6584 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 6585 | hhrtim->Instance->sTimerxRegs[TimerIdx].TIMxCR = hrtim_timcr; |
mbed_official | 237:f3da66175598 | 6586 | hhrtim->Instance->sTimerxRegs[TimerIdx].FLTxR = hrtim_timfltr; |
mbed_official | 237:f3da66175598 | 6587 | hhrtim->Instance->sTimerxRegs[TimerIdx].OUTxR = hrtim_timoutr; |
mbed_official | 237:f3da66175598 | 6588 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTxR = hrtim_timrstr; |
mbed_official | 237:f3da66175598 | 6589 | hhrtim->Instance->sCommonRegs.BMCR = hrtim_bmcr; |
mbed_official | 237:f3da66175598 | 6590 | } |
mbed_official | 237:f3da66175598 | 6591 | |
mbed_official | 237:f3da66175598 | 6592 | /** |
mbed_official | 237:f3da66175598 | 6593 | * @brief Configures a compare unit |
mbed_official | 237:f3da66175598 | 6594 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6595 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6596 | * @param CompareUnit: Compare unit identifier |
mbed_official | 237:f3da66175598 | 6597 | * @param pCompareCfg: pointer to the compare unit configuration data structure |
mbed_official | 237:f3da66175598 | 6598 | * @retval None |
mbed_official | 237:f3da66175598 | 6599 | */ |
mbed_official | 237:f3da66175598 | 6600 | static void HRTIM_CompareUnitConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6601 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 6602 | uint32_t CompareUnit, |
mbed_official | 237:f3da66175598 | 6603 | HRTIM_CompareCfgTypeDef * pCompareCfg) |
mbed_official | 237:f3da66175598 | 6604 | { |
mbed_official | 237:f3da66175598 | 6605 | if (TimerIdx == HRTIM_TIMERINDEX_MASTER) |
mbed_official | 237:f3da66175598 | 6606 | { |
mbed_official | 237:f3da66175598 | 6607 | /* Configure the compare unit of the master timer */ |
mbed_official | 237:f3da66175598 | 6608 | switch (CompareUnit) |
mbed_official | 237:f3da66175598 | 6609 | { |
mbed_official | 237:f3da66175598 | 6610 | case HRTIM_COMPAREUNIT_1: |
mbed_official | 237:f3da66175598 | 6611 | { |
mbed_official | 237:f3da66175598 | 6612 | hhrtim->Instance->sMasterRegs.MCMP1R = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 6613 | } |
mbed_official | 237:f3da66175598 | 6614 | break; |
mbed_official | 237:f3da66175598 | 6615 | case HRTIM_COMPAREUNIT_2: |
mbed_official | 237:f3da66175598 | 6616 | { |
mbed_official | 237:f3da66175598 | 6617 | hhrtim->Instance->sMasterRegs.MCMP2R = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 6618 | } |
mbed_official | 237:f3da66175598 | 6619 | break; |
mbed_official | 237:f3da66175598 | 6620 | case HRTIM_COMPAREUNIT_3: |
mbed_official | 237:f3da66175598 | 6621 | { |
mbed_official | 237:f3da66175598 | 6622 | hhrtim->Instance->sMasterRegs.MCMP3R = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 6623 | } |
mbed_official | 237:f3da66175598 | 6624 | break; |
mbed_official | 237:f3da66175598 | 6625 | case HRTIM_COMPAREUNIT_4: |
mbed_official | 237:f3da66175598 | 6626 | { |
mbed_official | 237:f3da66175598 | 6627 | hhrtim->Instance->sMasterRegs.MCMP4R = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 6628 | } |
mbed_official | 237:f3da66175598 | 6629 | break; |
mbed_official | 237:f3da66175598 | 6630 | } |
mbed_official | 237:f3da66175598 | 6631 | } |
mbed_official | 237:f3da66175598 | 6632 | else |
mbed_official | 237:f3da66175598 | 6633 | { |
mbed_official | 237:f3da66175598 | 6634 | /* Configure the compare unit of the timing unit */ |
mbed_official | 237:f3da66175598 | 6635 | switch (CompareUnit) |
mbed_official | 237:f3da66175598 | 6636 | { |
mbed_official | 237:f3da66175598 | 6637 | case HRTIM_COMPAREUNIT_1: |
mbed_official | 237:f3da66175598 | 6638 | { |
mbed_official | 237:f3da66175598 | 6639 | hhrtim->Instance->sTimerxRegs[TimerIdx].CMP1xR = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 6640 | } |
mbed_official | 237:f3da66175598 | 6641 | break; |
mbed_official | 237:f3da66175598 | 6642 | case HRTIM_COMPAREUNIT_2: |
mbed_official | 237:f3da66175598 | 6643 | { |
mbed_official | 237:f3da66175598 | 6644 | hhrtim->Instance->sTimerxRegs[TimerIdx].CMP2xR = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 6645 | } |
mbed_official | 237:f3da66175598 | 6646 | break; |
mbed_official | 237:f3da66175598 | 6647 | case HRTIM_COMPAREUNIT_3: |
mbed_official | 237:f3da66175598 | 6648 | { |
mbed_official | 237:f3da66175598 | 6649 | hhrtim->Instance->sTimerxRegs[TimerIdx].CMP3xR = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 6650 | } |
mbed_official | 237:f3da66175598 | 6651 | break; |
mbed_official | 237:f3da66175598 | 6652 | case HRTIM_COMPAREUNIT_4: |
mbed_official | 237:f3da66175598 | 6653 | { |
mbed_official | 237:f3da66175598 | 6654 | hhrtim->Instance->sTimerxRegs[TimerIdx].CMP4xR = pCompareCfg->CompareValue; |
mbed_official | 237:f3da66175598 | 6655 | } |
mbed_official | 237:f3da66175598 | 6656 | break; |
mbed_official | 237:f3da66175598 | 6657 | } |
mbed_official | 237:f3da66175598 | 6658 | } |
mbed_official | 237:f3da66175598 | 6659 | } |
mbed_official | 237:f3da66175598 | 6660 | |
mbed_official | 237:f3da66175598 | 6661 | /** |
mbed_official | 237:f3da66175598 | 6662 | * @brief Configures a capture unit |
mbed_official | 237:f3da66175598 | 6663 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6664 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6665 | * @param CaptureUnit: Capture unit identifier |
mbed_official | 237:f3da66175598 | 6666 | * @param Event: Event reference |
mbed_official | 237:f3da66175598 | 6667 | * @retval None |
mbed_official | 237:f3da66175598 | 6668 | */ |
mbed_official | 237:f3da66175598 | 6669 | static void HRTIM_CaptureUnitConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6670 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 6671 | uint32_t CaptureUnit, |
mbed_official | 237:f3da66175598 | 6672 | uint32_t Event) |
mbed_official | 237:f3da66175598 | 6673 | { |
mbed_official | 237:f3da66175598 | 6674 | uint32_t CaptureTrigger = 0xFFFFFFFF; |
mbed_official | 237:f3da66175598 | 6675 | |
mbed_official | 237:f3da66175598 | 6676 | switch (Event) |
mbed_official | 237:f3da66175598 | 6677 | { |
mbed_official | 237:f3da66175598 | 6678 | case HRTIM_EVENT_1: |
mbed_official | 237:f3da66175598 | 6679 | { |
mbed_official | 237:f3da66175598 | 6680 | CaptureTrigger = HRTIM_CAPTURETRIGGER_EEV_1; |
mbed_official | 237:f3da66175598 | 6681 | } |
mbed_official | 237:f3da66175598 | 6682 | break; |
mbed_official | 237:f3da66175598 | 6683 | case HRTIM_EVENT_2: |
mbed_official | 237:f3da66175598 | 6684 | { |
mbed_official | 237:f3da66175598 | 6685 | CaptureTrigger = HRTIM_CAPTURETRIGGER_EEV_2; |
mbed_official | 237:f3da66175598 | 6686 | } |
mbed_official | 237:f3da66175598 | 6687 | break; |
mbed_official | 237:f3da66175598 | 6688 | case HRTIM_EVENT_3: |
mbed_official | 237:f3da66175598 | 6689 | { |
mbed_official | 237:f3da66175598 | 6690 | CaptureTrigger = HRTIM_CAPTURETRIGGER_EEV_3; |
mbed_official | 237:f3da66175598 | 6691 | } |
mbed_official | 237:f3da66175598 | 6692 | break; |
mbed_official | 237:f3da66175598 | 6693 | case HRTIM_EVENT_4: |
mbed_official | 237:f3da66175598 | 6694 | { |
mbed_official | 237:f3da66175598 | 6695 | CaptureTrigger = HRTIM_CAPTURETRIGGER_EEV_4; |
mbed_official | 237:f3da66175598 | 6696 | } |
mbed_official | 237:f3da66175598 | 6697 | break; |
mbed_official | 237:f3da66175598 | 6698 | case HRTIM_EVENT_5: |
mbed_official | 237:f3da66175598 | 6699 | { |
mbed_official | 237:f3da66175598 | 6700 | CaptureTrigger = HRTIM_CAPTURETRIGGER_EEV_5; |
mbed_official | 237:f3da66175598 | 6701 | } |
mbed_official | 237:f3da66175598 | 6702 | break; |
mbed_official | 237:f3da66175598 | 6703 | case HRTIM_EVENT_6: |
mbed_official | 237:f3da66175598 | 6704 | { |
mbed_official | 237:f3da66175598 | 6705 | CaptureTrigger = HRTIM_CAPTURETRIGGER_EEV_6; |
mbed_official | 237:f3da66175598 | 6706 | } |
mbed_official | 237:f3da66175598 | 6707 | break; |
mbed_official | 237:f3da66175598 | 6708 | case HRTIM_EVENT_7: |
mbed_official | 237:f3da66175598 | 6709 | { |
mbed_official | 237:f3da66175598 | 6710 | CaptureTrigger = HRTIM_CAPTURETRIGGER_EEV_7; |
mbed_official | 237:f3da66175598 | 6711 | } |
mbed_official | 237:f3da66175598 | 6712 | break; |
mbed_official | 237:f3da66175598 | 6713 | case HRTIM_EVENT_8: |
mbed_official | 237:f3da66175598 | 6714 | { |
mbed_official | 237:f3da66175598 | 6715 | CaptureTrigger = HRTIM_CAPTURETRIGGER_EEV_8; |
mbed_official | 237:f3da66175598 | 6716 | } |
mbed_official | 237:f3da66175598 | 6717 | break; |
mbed_official | 237:f3da66175598 | 6718 | case HRTIM_EVENT_9: |
mbed_official | 237:f3da66175598 | 6719 | { |
mbed_official | 237:f3da66175598 | 6720 | CaptureTrigger = HRTIM_CAPTURETRIGGER_EEV_9; |
mbed_official | 237:f3da66175598 | 6721 | } |
mbed_official | 237:f3da66175598 | 6722 | break; |
mbed_official | 237:f3da66175598 | 6723 | case HRTIM_EVENT_10: |
mbed_official | 237:f3da66175598 | 6724 | { |
mbed_official | 237:f3da66175598 | 6725 | CaptureTrigger = HRTIM_CAPTURETRIGGER_EEV_10; |
mbed_official | 237:f3da66175598 | 6726 | } |
mbed_official | 237:f3da66175598 | 6727 | break; |
mbed_official | 237:f3da66175598 | 6728 | } |
mbed_official | 237:f3da66175598 | 6729 | |
mbed_official | 237:f3da66175598 | 6730 | switch (CaptureUnit) |
mbed_official | 237:f3da66175598 | 6731 | { |
mbed_official | 237:f3da66175598 | 6732 | case HRTIM_CAPTUREUNIT_1: |
mbed_official | 237:f3da66175598 | 6733 | { |
mbed_official | 237:f3da66175598 | 6734 | hhrtim->TimerParam[TimerIdx].CaptureTrigger1 = CaptureTrigger; |
mbed_official | 237:f3da66175598 | 6735 | } |
mbed_official | 237:f3da66175598 | 6736 | break; |
mbed_official | 237:f3da66175598 | 6737 | case HRTIM_CAPTUREUNIT_2: |
mbed_official | 237:f3da66175598 | 6738 | { |
mbed_official | 237:f3da66175598 | 6739 | hhrtim->TimerParam[TimerIdx].CaptureTrigger2 = CaptureTrigger; |
mbed_official | 237:f3da66175598 | 6740 | } |
mbed_official | 237:f3da66175598 | 6741 | break; |
mbed_official | 237:f3da66175598 | 6742 | } |
mbed_official | 237:f3da66175598 | 6743 | } |
mbed_official | 237:f3da66175598 | 6744 | |
mbed_official | 237:f3da66175598 | 6745 | /** |
mbed_official | 237:f3da66175598 | 6746 | * @brief Configures the output of a timing unit |
mbed_official | 237:f3da66175598 | 6747 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6748 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6749 | * @param Output: timing unit output identifier |
mbed_official | 237:f3da66175598 | 6750 | * @param pOutputCfg: pointer to the output configuration data structure |
mbed_official | 237:f3da66175598 | 6751 | * @retval None |
mbed_official | 237:f3da66175598 | 6752 | */ |
mbed_official | 237:f3da66175598 | 6753 | static void HRTIM_OutputConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6754 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 6755 | uint32_t Output, |
mbed_official | 237:f3da66175598 | 6756 | HRTIM_OutputCfgTypeDef * pOutputCfg) |
mbed_official | 237:f3da66175598 | 6757 | { |
mbed_official | 237:f3da66175598 | 6758 | uint32_t hrtim_outr; |
mbed_official | 237:f3da66175598 | 6759 | uint32_t hrtim_dtr; |
mbed_official | 237:f3da66175598 | 6760 | |
mbed_official | 237:f3da66175598 | 6761 | uint32_t shift = 0xFFFFFFFF; |
mbed_official | 237:f3da66175598 | 6762 | |
mbed_official | 237:f3da66175598 | 6763 | hrtim_outr = hhrtim->Instance->sTimerxRegs[TimerIdx].OUTxR; |
mbed_official | 237:f3da66175598 | 6764 | hrtim_dtr = hhrtim->Instance->sTimerxRegs[TimerIdx].DTxR; |
mbed_official | 237:f3da66175598 | 6765 | |
mbed_official | 237:f3da66175598 | 6766 | switch (Output) |
mbed_official | 237:f3da66175598 | 6767 | { |
mbed_official | 237:f3da66175598 | 6768 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 6769 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 6770 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 6771 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 6772 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 6773 | { |
mbed_official | 237:f3da66175598 | 6774 | /* Set the output set/reset crossbar */ |
mbed_official | 237:f3da66175598 | 6775 | hhrtim->Instance->sTimerxRegs[TimerIdx].SETx1R = pOutputCfg->SetSource; |
mbed_official | 237:f3da66175598 | 6776 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTx1R = pOutputCfg->ResetSource; |
mbed_official | 237:f3da66175598 | 6777 | |
mbed_official | 237:f3da66175598 | 6778 | shift = 0; |
mbed_official | 237:f3da66175598 | 6779 | } |
mbed_official | 237:f3da66175598 | 6780 | break; |
mbed_official | 237:f3da66175598 | 6781 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 6782 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 6783 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 6784 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 6785 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 6786 | { |
mbed_official | 237:f3da66175598 | 6787 | /* Set the output set/reset crossbar */ |
mbed_official | 237:f3da66175598 | 6788 | hhrtim->Instance->sTimerxRegs[TimerIdx].SETx2R = pOutputCfg->SetSource; |
mbed_official | 237:f3da66175598 | 6789 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTx2R = pOutputCfg->ResetSource; |
mbed_official | 237:f3da66175598 | 6790 | |
mbed_official | 237:f3da66175598 | 6791 | shift = 16; |
mbed_official | 237:f3da66175598 | 6792 | } |
mbed_official | 237:f3da66175598 | 6793 | break; |
mbed_official | 237:f3da66175598 | 6794 | } |
mbed_official | 237:f3da66175598 | 6795 | |
mbed_official | 237:f3da66175598 | 6796 | /* Clear output config */ |
mbed_official | 237:f3da66175598 | 6797 | hrtim_outr &= ~((HRTIM_OUTR_POL1 | |
mbed_official | 237:f3da66175598 | 6798 | HRTIM_OUTR_IDLM1 | |
mbed_official | 237:f3da66175598 | 6799 | HRTIM_OUTR_IDLES1| |
mbed_official | 237:f3da66175598 | 6800 | HRTIM_OUTR_FAULT1| |
mbed_official | 237:f3da66175598 | 6801 | HRTIM_OUTR_CHP1 | |
mbed_official | 237:f3da66175598 | 6802 | HRTIM_OUTR_DIDL1) << shift); |
mbed_official | 237:f3da66175598 | 6803 | |
mbed_official | 237:f3da66175598 | 6804 | /* Set the polarity */ |
mbed_official | 237:f3da66175598 | 6805 | hrtim_outr |= (pOutputCfg->Polarity << shift); |
mbed_official | 237:f3da66175598 | 6806 | |
mbed_official | 237:f3da66175598 | 6807 | /* Set the IDLE mode */ |
mbed_official | 237:f3da66175598 | 6808 | hrtim_outr |= (pOutputCfg->IdleMode << shift); |
mbed_official | 237:f3da66175598 | 6809 | |
mbed_official | 237:f3da66175598 | 6810 | /* Set the IDLE state */ |
mbed_official | 237:f3da66175598 | 6811 | hrtim_outr |= (pOutputCfg->IdleLevel << shift); |
mbed_official | 237:f3da66175598 | 6812 | |
mbed_official | 237:f3da66175598 | 6813 | /* Set the FAULT state */ |
mbed_official | 237:f3da66175598 | 6814 | hrtim_outr |= (pOutputCfg->FaultLevel << shift); |
mbed_official | 237:f3da66175598 | 6815 | |
mbed_official | 237:f3da66175598 | 6816 | /* Set the chopper mode */ |
mbed_official | 237:f3da66175598 | 6817 | hrtim_outr |= (pOutputCfg->ChopperModeEnable << shift); |
mbed_official | 237:f3da66175598 | 6818 | |
mbed_official | 237:f3da66175598 | 6819 | /* Set the burst mode entry mode : deadtime insertion when entering the idle |
mbed_official | 237:f3da66175598 | 6820 | state during a burst mode operation is allowed only under the following |
mbed_official | 237:f3da66175598 | 6821 | conditions: |
mbed_official | 237:f3da66175598 | 6822 | - the outputs is active during the burst mode (IDLES=1) |
mbed_official | 237:f3da66175598 | 6823 | - positive deadtimes (SDTR/SDTF set to 0) |
mbed_official | 237:f3da66175598 | 6824 | */ |
mbed_official | 237:f3da66175598 | 6825 | if ((pOutputCfg->IdleLevel == HRTIM_OUTPUTIDLELEVEL_ACTIVE) && |
mbed_official | 237:f3da66175598 | 6826 | ((hrtim_dtr & HRTIM_DTR_SDTR) == RESET) && |
mbed_official | 237:f3da66175598 | 6827 | ((hrtim_dtr & HRTIM_DTR_SDTF) == RESET)) |
mbed_official | 237:f3da66175598 | 6828 | { |
mbed_official | 237:f3da66175598 | 6829 | hrtim_outr |= (pOutputCfg->BurstModeEntryDelayed << shift); |
mbed_official | 237:f3da66175598 | 6830 | } |
mbed_official | 237:f3da66175598 | 6831 | |
mbed_official | 237:f3da66175598 | 6832 | /* Update HRTIM register */ |
mbed_official | 237:f3da66175598 | 6833 | hhrtim->Instance->sTimerxRegs[TimerIdx].OUTxR = hrtim_outr; |
mbed_official | 237:f3da66175598 | 6834 | } |
mbed_official | 237:f3da66175598 | 6835 | |
mbed_official | 237:f3da66175598 | 6836 | /** |
mbed_official | 237:f3da66175598 | 6837 | * @brief Configures an external event channel |
mbed_official | 237:f3da66175598 | 6838 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6839 | * @param Event: Event channel identifier |
mbed_official | 237:f3da66175598 | 6840 | * @param pEventCfg: pointer to the event channel configuration data structure |
mbed_official | 237:f3da66175598 | 6841 | * @retval None |
mbed_official | 237:f3da66175598 | 6842 | */ |
mbed_official | 237:f3da66175598 | 6843 | static void HRTIM_EventConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 6844 | uint32_t Event, |
mbed_official | 237:f3da66175598 | 6845 | HRTIM_EventCfgTypeDef *pEventCfg) |
mbed_official | 237:f3da66175598 | 6846 | { |
mbed_official | 237:f3da66175598 | 6847 | uint32_t hrtim_eecr1; |
mbed_official | 237:f3da66175598 | 6848 | uint32_t hrtim_eecr2; |
mbed_official | 237:f3da66175598 | 6849 | uint32_t hrtim_eecr3; |
mbed_official | 237:f3da66175598 | 6850 | |
mbed_official | 237:f3da66175598 | 6851 | /* Configure external event channel */ |
mbed_official | 237:f3da66175598 | 6852 | hrtim_eecr1 = hhrtim->Instance->sCommonRegs.EECR1; |
mbed_official | 237:f3da66175598 | 6853 | hrtim_eecr2 = hhrtim->Instance->sCommonRegs.EECR2; |
mbed_official | 237:f3da66175598 | 6854 | hrtim_eecr3 = hhrtim->Instance->sCommonRegs.EECR3; |
mbed_official | 237:f3da66175598 | 6855 | |
mbed_official | 237:f3da66175598 | 6856 | switch (Event) |
mbed_official | 237:f3da66175598 | 6857 | { |
mbed_official | 237:f3da66175598 | 6858 | case HRTIM_EVENT_1: |
mbed_official | 237:f3da66175598 | 6859 | { |
mbed_official | 237:f3da66175598 | 6860 | hrtim_eecr1 &= ~(HRTIM_EECR1_EE1SRC | HRTIM_EECR1_EE1POL | HRTIM_EECR1_EE1SNS | HRTIM_EECR1_EE1FAST); |
mbed_official | 237:f3da66175598 | 6861 | hrtim_eecr1 |= pEventCfg->Source; |
mbed_official | 237:f3da66175598 | 6862 | hrtim_eecr1 |= (pEventCfg->Polarity & HRTIM_EECR1_EE1POL); |
mbed_official | 237:f3da66175598 | 6863 | hrtim_eecr1 |= pEventCfg->Sensitivity; |
mbed_official | 237:f3da66175598 | 6864 | /* Update the HRTIM registers (all bitfields but EE1FAST bit) */ |
mbed_official | 237:f3da66175598 | 6865 | hhrtim->Instance->sCommonRegs.EECR1 = hrtim_eecr1; |
mbed_official | 237:f3da66175598 | 6866 | /* Update the HRTIM registers (EE1FAST bit) */ |
mbed_official | 237:f3da66175598 | 6867 | hrtim_eecr1 |= pEventCfg->FastMode; |
mbed_official | 237:f3da66175598 | 6868 | hhrtim->Instance->sCommonRegs.EECR1 = hrtim_eecr1; |
mbed_official | 237:f3da66175598 | 6869 | } |
mbed_official | 237:f3da66175598 | 6870 | break; |
mbed_official | 237:f3da66175598 | 6871 | case HRTIM_EVENT_2: |
mbed_official | 237:f3da66175598 | 6872 | { |
mbed_official | 237:f3da66175598 | 6873 | hrtim_eecr1 &= ~(HRTIM_EECR1_EE2SRC | HRTIM_EECR1_EE2POL | HRTIM_EECR1_EE2SNS | HRTIM_EECR1_EE2FAST); |
mbed_official | 237:f3da66175598 | 6874 | hrtim_eecr1 |= (pEventCfg->Source << 6); |
mbed_official | 237:f3da66175598 | 6875 | hrtim_eecr1 |= ((pEventCfg->Polarity << 6) & (HRTIM_EECR1_EE2POL)); |
mbed_official | 237:f3da66175598 | 6876 | hrtim_eecr1 |= (pEventCfg->Sensitivity << 6); |
mbed_official | 237:f3da66175598 | 6877 | /* Update the HRTIM registers (all bitfields but EE2FAST bit) */ |
mbed_official | 237:f3da66175598 | 6878 | hhrtim->Instance->sCommonRegs.EECR1 = hrtim_eecr1; |
mbed_official | 237:f3da66175598 | 6879 | /* Update the HRTIM registers (EE2FAST bit) */ |
mbed_official | 237:f3da66175598 | 6880 | hrtim_eecr1 |= (pEventCfg->FastMode << 6); |
mbed_official | 237:f3da66175598 | 6881 | hhrtim->Instance->sCommonRegs.EECR1 = hrtim_eecr1; |
mbed_official | 237:f3da66175598 | 6882 | } |
mbed_official | 237:f3da66175598 | 6883 | break; |
mbed_official | 237:f3da66175598 | 6884 | case HRTIM_EVENT_3: |
mbed_official | 237:f3da66175598 | 6885 | { |
mbed_official | 237:f3da66175598 | 6886 | hrtim_eecr1 &= ~(HRTIM_EECR1_EE3SRC | HRTIM_EECR1_EE3POL | HRTIM_EECR1_EE3SNS | HRTIM_EECR1_EE3FAST); |
mbed_official | 237:f3da66175598 | 6887 | hrtim_eecr1 |= (pEventCfg->Source << 12); |
mbed_official | 237:f3da66175598 | 6888 | hrtim_eecr1 |= ((pEventCfg->Polarity << 12) & (HRTIM_EECR1_EE3POL)); |
mbed_official | 237:f3da66175598 | 6889 | hrtim_eecr1 |= (pEventCfg->Sensitivity << 12); |
mbed_official | 237:f3da66175598 | 6890 | /* Update the HRTIM registers (all bitfields but EE3FAST bit) */ |
mbed_official | 237:f3da66175598 | 6891 | hhrtim->Instance->sCommonRegs.EECR1 = hrtim_eecr1; |
mbed_official | 237:f3da66175598 | 6892 | /* Update the HRTIM registers (EE3FAST bit) */ |
mbed_official | 237:f3da66175598 | 6893 | hrtim_eecr1 |= (pEventCfg->FastMode << 12); |
mbed_official | 237:f3da66175598 | 6894 | hhrtim->Instance->sCommonRegs.EECR1 = hrtim_eecr1; |
mbed_official | 237:f3da66175598 | 6895 | } |
mbed_official | 237:f3da66175598 | 6896 | break; |
mbed_official | 237:f3da66175598 | 6897 | case HRTIM_EVENT_4: |
mbed_official | 237:f3da66175598 | 6898 | { |
mbed_official | 237:f3da66175598 | 6899 | hrtim_eecr1 &= ~(HRTIM_EECR1_EE4SRC | HRTIM_EECR1_EE4POL | HRTIM_EECR1_EE4SNS | HRTIM_EECR1_EE4FAST); |
mbed_official | 237:f3da66175598 | 6900 | hrtim_eecr1 |= (pEventCfg->Source << 18); |
mbed_official | 237:f3da66175598 | 6901 | hrtim_eecr1 |= ((pEventCfg->Polarity << 18) & (HRTIM_EECR1_EE4POL)); |
mbed_official | 237:f3da66175598 | 6902 | hrtim_eecr1 |= (pEventCfg->Sensitivity << 18); |
mbed_official | 237:f3da66175598 | 6903 | /* Update the HRTIM registers (all bitfields but EE4FAST bit) */ |
mbed_official | 237:f3da66175598 | 6904 | hhrtim->Instance->sCommonRegs.EECR1 = hrtim_eecr1; |
mbed_official | 237:f3da66175598 | 6905 | /* Update the HRTIM registers (EE4FAST bit) */ |
mbed_official | 237:f3da66175598 | 6906 | hrtim_eecr1 |= (pEventCfg->FastMode << 18); |
mbed_official | 237:f3da66175598 | 6907 | hhrtim->Instance->sCommonRegs.EECR1 = hrtim_eecr1; |
mbed_official | 237:f3da66175598 | 6908 | } |
mbed_official | 237:f3da66175598 | 6909 | break; |
mbed_official | 237:f3da66175598 | 6910 | case HRTIM_EVENT_5: |
mbed_official | 237:f3da66175598 | 6911 | { |
mbed_official | 237:f3da66175598 | 6912 | hrtim_eecr1 &= ~(HRTIM_EECR1_EE5SRC | HRTIM_EECR1_EE5POL | HRTIM_EECR1_EE5SNS | HRTIM_EECR1_EE5FAST); |
mbed_official | 237:f3da66175598 | 6913 | hrtim_eecr1 |= (pEventCfg->Source << 24); |
mbed_official | 237:f3da66175598 | 6914 | hrtim_eecr1 |= ((pEventCfg->Polarity << 24) & (HRTIM_EECR1_EE5POL)); |
mbed_official | 237:f3da66175598 | 6915 | hrtim_eecr1 |= (pEventCfg->Sensitivity << 24); |
mbed_official | 237:f3da66175598 | 6916 | /* Update the HRTIM registers (all bitfields but EE5FAST bit) */ |
mbed_official | 237:f3da66175598 | 6917 | hhrtim->Instance->sCommonRegs.EECR1 = hrtim_eecr1; |
mbed_official | 237:f3da66175598 | 6918 | /* Update the HRTIM registers (EE5FAST bit) */ |
mbed_official | 237:f3da66175598 | 6919 | hrtim_eecr1 |= (pEventCfg->FastMode << 24); |
mbed_official | 237:f3da66175598 | 6920 | hhrtim->Instance->sCommonRegs.EECR1 = hrtim_eecr1; |
mbed_official | 237:f3da66175598 | 6921 | } |
mbed_official | 237:f3da66175598 | 6922 | break; |
mbed_official | 237:f3da66175598 | 6923 | case HRTIM_EVENT_6: |
mbed_official | 237:f3da66175598 | 6924 | { |
mbed_official | 237:f3da66175598 | 6925 | hrtim_eecr2 &= ~(HRTIM_EECR2_EE6SRC | HRTIM_EECR2_EE6POL | HRTIM_EECR2_EE6SNS); |
mbed_official | 237:f3da66175598 | 6926 | hrtim_eecr2 |= pEventCfg->Source; |
mbed_official | 237:f3da66175598 | 6927 | hrtim_eecr2 |= (pEventCfg->Polarity & HRTIM_EECR2_EE6POL); |
mbed_official | 237:f3da66175598 | 6928 | hrtim_eecr2 |= pEventCfg->Sensitivity; |
mbed_official | 237:f3da66175598 | 6929 | hrtim_eecr3 &= ~(HRTIM_EECR3_EE6F); |
mbed_official | 237:f3da66175598 | 6930 | hrtim_eecr3 |= pEventCfg->Filter; |
mbed_official | 237:f3da66175598 | 6931 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 6932 | hhrtim->Instance->sCommonRegs.EECR2 = hrtim_eecr2; |
mbed_official | 237:f3da66175598 | 6933 | hhrtim->Instance->sCommonRegs.EECR3 = hrtim_eecr3; |
mbed_official | 237:f3da66175598 | 6934 | } |
mbed_official | 237:f3da66175598 | 6935 | break; |
mbed_official | 237:f3da66175598 | 6936 | case HRTIM_EVENT_7: |
mbed_official | 237:f3da66175598 | 6937 | { |
mbed_official | 237:f3da66175598 | 6938 | hrtim_eecr2 &= ~(HRTIM_EECR2_EE7SRC | HRTIM_EECR2_EE7POL | HRTIM_EECR2_EE7SNS); |
mbed_official | 237:f3da66175598 | 6939 | hrtim_eecr2 |= (pEventCfg->Source << 6); |
mbed_official | 237:f3da66175598 | 6940 | hrtim_eecr2 |= ((pEventCfg->Polarity << 6) & (HRTIM_EECR2_EE7POL)); |
mbed_official | 237:f3da66175598 | 6941 | hrtim_eecr2 |= (pEventCfg->Sensitivity << 6); |
mbed_official | 237:f3da66175598 | 6942 | hrtim_eecr3 &= ~(HRTIM_EECR3_EE7F); |
mbed_official | 237:f3da66175598 | 6943 | hrtim_eecr3 |= (pEventCfg->Filter << 6); |
mbed_official | 237:f3da66175598 | 6944 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 6945 | hhrtim->Instance->sCommonRegs.EECR2 = hrtim_eecr2; |
mbed_official | 237:f3da66175598 | 6946 | hhrtim->Instance->sCommonRegs.EECR3 = hrtim_eecr3; |
mbed_official | 237:f3da66175598 | 6947 | } |
mbed_official | 237:f3da66175598 | 6948 | break; |
mbed_official | 237:f3da66175598 | 6949 | case HRTIM_EVENT_8: |
mbed_official | 237:f3da66175598 | 6950 | { |
mbed_official | 237:f3da66175598 | 6951 | hrtim_eecr2 &= ~(HRTIM_EECR2_EE8SRC | HRTIM_EECR2_EE8POL | HRTIM_EECR2_EE8SNS); |
mbed_official | 237:f3da66175598 | 6952 | hrtim_eecr2 |= (pEventCfg->Source << 12); |
mbed_official | 237:f3da66175598 | 6953 | hrtim_eecr2 |= ((pEventCfg->Polarity << 12) & (HRTIM_EECR2_EE8POL)); |
mbed_official | 237:f3da66175598 | 6954 | hrtim_eecr2 |= (pEventCfg->Sensitivity << 12); |
mbed_official | 237:f3da66175598 | 6955 | hrtim_eecr3 &= ~(HRTIM_EECR3_EE8F); |
mbed_official | 237:f3da66175598 | 6956 | hrtim_eecr3 |= (pEventCfg->Filter << 12); |
mbed_official | 237:f3da66175598 | 6957 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 6958 | hhrtim->Instance->sCommonRegs.EECR2 = hrtim_eecr2; |
mbed_official | 237:f3da66175598 | 6959 | hhrtim->Instance->sCommonRegs.EECR3 = hrtim_eecr3; |
mbed_official | 237:f3da66175598 | 6960 | } |
mbed_official | 237:f3da66175598 | 6961 | break; |
mbed_official | 237:f3da66175598 | 6962 | case HRTIM_EVENT_9: |
mbed_official | 237:f3da66175598 | 6963 | { |
mbed_official | 237:f3da66175598 | 6964 | hrtim_eecr2 &= ~(HRTIM_EECR2_EE9SRC | HRTIM_EECR2_EE9POL | HRTIM_EECR2_EE9SNS); |
mbed_official | 237:f3da66175598 | 6965 | hrtim_eecr2 |= (pEventCfg->Source << 18); |
mbed_official | 237:f3da66175598 | 6966 | hrtim_eecr2 |= ((pEventCfg->Polarity << 18) & (HRTIM_EECR2_EE9POL)); |
mbed_official | 237:f3da66175598 | 6967 | hrtim_eecr2 |= (pEventCfg->Sensitivity << 18); |
mbed_official | 237:f3da66175598 | 6968 | hrtim_eecr3 &= ~(HRTIM_EECR3_EE9F); |
mbed_official | 237:f3da66175598 | 6969 | hrtim_eecr3 |= (pEventCfg->Filter << 18); |
mbed_official | 237:f3da66175598 | 6970 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 6971 | hhrtim->Instance->sCommonRegs.EECR2 = hrtim_eecr2; |
mbed_official | 237:f3da66175598 | 6972 | hhrtim->Instance->sCommonRegs.EECR3 = hrtim_eecr3; |
mbed_official | 237:f3da66175598 | 6973 | } |
mbed_official | 237:f3da66175598 | 6974 | break; |
mbed_official | 237:f3da66175598 | 6975 | case HRTIM_EVENT_10: |
mbed_official | 237:f3da66175598 | 6976 | { |
mbed_official | 237:f3da66175598 | 6977 | hrtim_eecr2 &= ~(HRTIM_EECR2_EE10SRC | HRTIM_EECR2_EE10POL | HRTIM_EECR2_EE10SNS); |
mbed_official | 237:f3da66175598 | 6978 | hrtim_eecr2 |= (pEventCfg->Source << 24); |
mbed_official | 237:f3da66175598 | 6979 | hrtim_eecr2 |= ((pEventCfg->Polarity << 24) & (HRTIM_EECR2_EE10POL)); |
mbed_official | 237:f3da66175598 | 6980 | hrtim_eecr2 |= (pEventCfg->Sensitivity << 24); |
mbed_official | 237:f3da66175598 | 6981 | hrtim_eecr3 &= ~(HRTIM_EECR3_EE10F); |
mbed_official | 237:f3da66175598 | 6982 | hrtim_eecr3 |= (pEventCfg->Filter << 24); |
mbed_official | 237:f3da66175598 | 6983 | /* Update the HRTIM registers */ |
mbed_official | 237:f3da66175598 | 6984 | hhrtim->Instance->sCommonRegs.EECR2 = hrtim_eecr2; |
mbed_official | 237:f3da66175598 | 6985 | hhrtim->Instance->sCommonRegs.EECR3 = hrtim_eecr3; |
mbed_official | 237:f3da66175598 | 6986 | } |
mbed_official | 237:f3da66175598 | 6987 | break; |
mbed_official | 237:f3da66175598 | 6988 | default: |
mbed_official | 237:f3da66175598 | 6989 | break; |
mbed_official | 237:f3da66175598 | 6990 | } |
mbed_official | 237:f3da66175598 | 6991 | } |
mbed_official | 237:f3da66175598 | 6992 | |
mbed_official | 237:f3da66175598 | 6993 | /** |
mbed_official | 237:f3da66175598 | 6994 | * @brief Configures the timer counter reset |
mbed_official | 237:f3da66175598 | 6995 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 6996 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 6997 | * @param Event: Event channel identifier |
mbed_official | 237:f3da66175598 | 6998 | * @retval None |
mbed_official | 237:f3da66175598 | 6999 | */ |
mbed_official | 237:f3da66175598 | 7000 | static void HRTIM_TIM_ResetConfig(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 7001 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 7002 | uint32_t Event) |
mbed_official | 237:f3da66175598 | 7003 | { |
mbed_official | 237:f3da66175598 | 7004 | switch (Event) |
mbed_official | 237:f3da66175598 | 7005 | { |
mbed_official | 237:f3da66175598 | 7006 | case HRTIM_EVENT_1: |
mbed_official | 237:f3da66175598 | 7007 | { |
mbed_official | 237:f3da66175598 | 7008 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTxR = HRTIM_TIMRESETTRIGGER_EEV_1; |
mbed_official | 237:f3da66175598 | 7009 | } |
mbed_official | 237:f3da66175598 | 7010 | break; |
mbed_official | 237:f3da66175598 | 7011 | case HRTIM_EVENT_2: |
mbed_official | 237:f3da66175598 | 7012 | { |
mbed_official | 237:f3da66175598 | 7013 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTxR = HRTIM_TIMRESETTRIGGER_EEV_2; |
mbed_official | 237:f3da66175598 | 7014 | } |
mbed_official | 237:f3da66175598 | 7015 | break; |
mbed_official | 237:f3da66175598 | 7016 | case HRTIM_EVENT_3: |
mbed_official | 237:f3da66175598 | 7017 | { |
mbed_official | 237:f3da66175598 | 7018 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTxR = HRTIM_TIMRESETTRIGGER_EEV_3; |
mbed_official | 237:f3da66175598 | 7019 | } |
mbed_official | 237:f3da66175598 | 7020 | break; |
mbed_official | 237:f3da66175598 | 7021 | case HRTIM_EVENT_4: |
mbed_official | 237:f3da66175598 | 7022 | { |
mbed_official | 237:f3da66175598 | 7023 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTxR = HRTIM_TIMRESETTRIGGER_EEV_4; |
mbed_official | 237:f3da66175598 | 7024 | } |
mbed_official | 237:f3da66175598 | 7025 | break; |
mbed_official | 237:f3da66175598 | 7026 | case HRTIM_EVENT_5: |
mbed_official | 237:f3da66175598 | 7027 | { |
mbed_official | 237:f3da66175598 | 7028 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTxR = HRTIM_TIMRESETTRIGGER_EEV_5; |
mbed_official | 237:f3da66175598 | 7029 | } |
mbed_official | 237:f3da66175598 | 7030 | break; |
mbed_official | 237:f3da66175598 | 7031 | case HRTIM_EVENT_6: |
mbed_official | 237:f3da66175598 | 7032 | { |
mbed_official | 237:f3da66175598 | 7033 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTxR = HRTIM_TIMRESETTRIGGER_EEV_6; |
mbed_official | 237:f3da66175598 | 7034 | } |
mbed_official | 237:f3da66175598 | 7035 | break; |
mbed_official | 237:f3da66175598 | 7036 | case HRTIM_EVENT_7: |
mbed_official | 237:f3da66175598 | 7037 | { |
mbed_official | 237:f3da66175598 | 7038 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTxR = HRTIM_TIMRESETTRIGGER_EEV_7; |
mbed_official | 237:f3da66175598 | 7039 | } |
mbed_official | 237:f3da66175598 | 7040 | break; |
mbed_official | 237:f3da66175598 | 7041 | case HRTIM_EVENT_8: |
mbed_official | 237:f3da66175598 | 7042 | { |
mbed_official | 237:f3da66175598 | 7043 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTxR = HRTIM_TIMRESETTRIGGER_EEV_8; |
mbed_official | 237:f3da66175598 | 7044 | } |
mbed_official | 237:f3da66175598 | 7045 | break; |
mbed_official | 237:f3da66175598 | 7046 | case HRTIM_EVENT_9: |
mbed_official | 237:f3da66175598 | 7047 | { |
mbed_official | 237:f3da66175598 | 7048 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTxR = HRTIM_TIMRESETTRIGGER_EEV_9; |
mbed_official | 237:f3da66175598 | 7049 | } |
mbed_official | 237:f3da66175598 | 7050 | break; |
mbed_official | 237:f3da66175598 | 7051 | case HRTIM_EVENT_10: |
mbed_official | 237:f3da66175598 | 7052 | { |
mbed_official | 237:f3da66175598 | 7053 | hhrtim->Instance->sTimerxRegs[TimerIdx].RSTxR = HRTIM_TIMRESETTRIGGER_EEV_10; |
mbed_official | 237:f3da66175598 | 7054 | } |
mbed_official | 237:f3da66175598 | 7055 | break; |
mbed_official | 237:f3da66175598 | 7056 | } |
mbed_official | 237:f3da66175598 | 7057 | } |
mbed_official | 237:f3da66175598 | 7058 | |
mbed_official | 237:f3da66175598 | 7059 | /** |
mbed_official | 237:f3da66175598 | 7060 | * @brief Returns the interrupt to enable or disable according to the |
mbed_official | 237:f3da66175598 | 7061 | * OC mode. |
mbed_official | 237:f3da66175598 | 7062 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 7063 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 7064 | * @param OCChannel: Timer output |
mbed_official | 237:f3da66175598 | 7065 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 7066 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 7067 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 7068 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 7069 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 7070 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 7071 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 7072 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 7073 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 7074 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 7075 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 7076 | * @retval Interrupt to enable or disable |
mbed_official | 237:f3da66175598 | 7077 | */ |
mbed_official | 237:f3da66175598 | 7078 | static uint32_t HRTIM_GetITFromOCMode(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 7079 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 7080 | uint32_t OCChannel) |
mbed_official | 237:f3da66175598 | 7081 | { |
mbed_official | 237:f3da66175598 | 7082 | uint32_t hrtim_set; |
mbed_official | 237:f3da66175598 | 7083 | uint32_t hrtim_reset; |
mbed_official | 237:f3da66175598 | 7084 | uint32_t interrupt = 0; |
mbed_official | 237:f3da66175598 | 7085 | |
mbed_official | 237:f3da66175598 | 7086 | switch (OCChannel) |
mbed_official | 237:f3da66175598 | 7087 | { |
mbed_official | 237:f3da66175598 | 7088 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 7089 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 7090 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 7091 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 7092 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 7093 | { |
mbed_official | 237:f3da66175598 | 7094 | /* Retreives actual OC mode and set interrupt accordingly */ |
mbed_official | 237:f3da66175598 | 7095 | hrtim_set = hhrtim->Instance->sTimerxRegs[TimerIdx].SETx1R; |
mbed_official | 237:f3da66175598 | 7096 | hrtim_reset = hhrtim->Instance->sTimerxRegs[TimerIdx].RSTx1R; |
mbed_official | 237:f3da66175598 | 7097 | |
mbed_official | 237:f3da66175598 | 7098 | if (((hrtim_set & HRTIM_OUTPUTSET_TIMCMP1) == HRTIM_OUTPUTSET_TIMCMP1) && |
mbed_official | 237:f3da66175598 | 7099 | ((hrtim_reset & HRTIM_OUTPUTSET_TIMCMP1) == HRTIM_OUTPUTSET_TIMCMP1)) |
mbed_official | 237:f3da66175598 | 7100 | { |
mbed_official | 237:f3da66175598 | 7101 | /* OC mode: HRTIM_BASICOCMODE_TOGGLE */ |
mbed_official | 237:f3da66175598 | 7102 | interrupt = HRTIM_TIM_IT_CMP1; |
mbed_official | 237:f3da66175598 | 7103 | } |
mbed_official | 237:f3da66175598 | 7104 | else if (((hrtim_set & HRTIM_OUTPUTSET_TIMCMP1) == HRTIM_OUTPUTSET_TIMCMP1) && |
mbed_official | 237:f3da66175598 | 7105 | (hrtim_reset == 0)) |
mbed_official | 237:f3da66175598 | 7106 | { |
mbed_official | 237:f3da66175598 | 7107 | /* OC mode: HRTIM_BASICOCMODE_ACTIVE */ |
mbed_official | 237:f3da66175598 | 7108 | interrupt = HRTIM_TIM_IT_SET1; |
mbed_official | 237:f3da66175598 | 7109 | } |
mbed_official | 237:f3da66175598 | 7110 | else if ((hrtim_set == 0) && |
mbed_official | 237:f3da66175598 | 7111 | ((hrtim_reset & HRTIM_OUTPUTSET_TIMCMP1) == HRTIM_OUTPUTSET_TIMCMP1)) |
mbed_official | 237:f3da66175598 | 7112 | { |
mbed_official | 237:f3da66175598 | 7113 | /* OC mode: HRTIM_BASICOCMODE_INACTIVE */ |
mbed_official | 237:f3da66175598 | 7114 | interrupt = HRTIM_TIM_IT_RST1; |
mbed_official | 237:f3da66175598 | 7115 | } |
mbed_official | 237:f3da66175598 | 7116 | } |
mbed_official | 237:f3da66175598 | 7117 | break; |
mbed_official | 237:f3da66175598 | 7118 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 7119 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 7120 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 7121 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 7122 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 7123 | { |
mbed_official | 237:f3da66175598 | 7124 | /* Retreives actual OC mode and set interrupt accordingly */ |
mbed_official | 237:f3da66175598 | 7125 | hrtim_set = hhrtim->Instance->sTimerxRegs[TimerIdx].SETx2R; |
mbed_official | 237:f3da66175598 | 7126 | hrtim_reset = hhrtim->Instance->sTimerxRegs[TimerIdx].RSTx2R; |
mbed_official | 237:f3da66175598 | 7127 | |
mbed_official | 237:f3da66175598 | 7128 | if (((hrtim_set & HRTIM_OUTPUTSET_TIMCMP2) == HRTIM_OUTPUTSET_TIMCMP2) && |
mbed_official | 237:f3da66175598 | 7129 | ((hrtim_reset & HRTIM_OUTPUTSET_TIMCMP2) == HRTIM_OUTPUTSET_TIMCMP2)) |
mbed_official | 237:f3da66175598 | 7130 | { |
mbed_official | 237:f3da66175598 | 7131 | /* OC mode: HRTIM_BASICOCMODE_TOGGLE */ |
mbed_official | 237:f3da66175598 | 7132 | interrupt = HRTIM_TIM_IT_CMP2; |
mbed_official | 237:f3da66175598 | 7133 | } |
mbed_official | 237:f3da66175598 | 7134 | else if (((hrtim_set & HRTIM_OUTPUTSET_TIMCMP2) == HRTIM_OUTPUTSET_TIMCMP2) && |
mbed_official | 237:f3da66175598 | 7135 | (hrtim_reset == 0)) |
mbed_official | 237:f3da66175598 | 7136 | { |
mbed_official | 237:f3da66175598 | 7137 | /* OC mode: HRTIM_BASICOCMODE_ACTIVE */ |
mbed_official | 237:f3da66175598 | 7138 | interrupt = HRTIM_TIM_IT_SET2; |
mbed_official | 237:f3da66175598 | 7139 | } |
mbed_official | 237:f3da66175598 | 7140 | else if ((hrtim_set == 0) && |
mbed_official | 237:f3da66175598 | 7141 | ((hrtim_reset & HRTIM_OUTPUTSET_TIMCMP2) == HRTIM_OUTPUTSET_TIMCMP2)) |
mbed_official | 237:f3da66175598 | 7142 | { |
mbed_official | 237:f3da66175598 | 7143 | /* OC mode: HRTIM_BASICOCMODE_INACTIVE */ |
mbed_official | 237:f3da66175598 | 7144 | interrupt = HRTIM_TIM_IT_RST2; |
mbed_official | 237:f3da66175598 | 7145 | } |
mbed_official | 237:f3da66175598 | 7146 | } |
mbed_official | 237:f3da66175598 | 7147 | break; |
mbed_official | 237:f3da66175598 | 7148 | } |
mbed_official | 237:f3da66175598 | 7149 | |
mbed_official | 237:f3da66175598 | 7150 | return interrupt; |
mbed_official | 237:f3da66175598 | 7151 | } |
mbed_official | 237:f3da66175598 | 7152 | |
mbed_official | 237:f3da66175598 | 7153 | /** |
mbed_official | 237:f3da66175598 | 7154 | * @brief Returns the DMA request to enable or disable according to the |
mbed_official | 237:f3da66175598 | 7155 | * OC mode. |
mbed_official | 237:f3da66175598 | 7156 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 7157 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 7158 | * @param OCChannel: Timer output |
mbed_official | 237:f3da66175598 | 7159 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 7160 | * @arg HRTIM_OUTPUT_TA1: Timer A - Ouput 1 |
mbed_official | 237:f3da66175598 | 7161 | * @arg HRTIM_OUTPUT_TA2: Timer A - Ouput 2 |
mbed_official | 237:f3da66175598 | 7162 | * @arg HRTIM_OUTPUT_TB1: Timer B - Ouput 1 |
mbed_official | 237:f3da66175598 | 7163 | * @arg HRTIM_OUTPUT_TB2: Timer B - Ouput 2 |
mbed_official | 237:f3da66175598 | 7164 | * @arg HRTIM_OUTPUT_TC1: Timer C - Ouput 1 |
mbed_official | 237:f3da66175598 | 7165 | * @arg HRTIM_OUTPUT_TC2: Timer C - Ouput 2 |
mbed_official | 237:f3da66175598 | 7166 | * @arg HRTIM_OUTPUT_TD1: Timer D - Ouput 1 |
mbed_official | 237:f3da66175598 | 7167 | * @arg HRTIM_OUTPUT_TD2: Timer D - Ouput 2 |
mbed_official | 237:f3da66175598 | 7168 | * @arg HRTIM_OUTPUT_TE1: Timer E - Ouput 1 |
mbed_official | 237:f3da66175598 | 7169 | * @arg HRTIM_OUTPUT_TE2: Timer E - Ouput 2 |
mbed_official | 237:f3da66175598 | 7170 | * @retval DMA request to enable or disable |
mbed_official | 237:f3da66175598 | 7171 | */ |
mbed_official | 237:f3da66175598 | 7172 | static uint32_t HRTIM_GetDMAFromOCMode(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 7173 | uint32_t TimerIdx, |
mbed_official | 237:f3da66175598 | 7174 | uint32_t OCChannel) |
mbed_official | 237:f3da66175598 | 7175 | { |
mbed_official | 237:f3da66175598 | 7176 | uint32_t hrtim_set; |
mbed_official | 237:f3da66175598 | 7177 | uint32_t hrtim_reset; |
mbed_official | 237:f3da66175598 | 7178 | uint32_t dma_request = 0; |
mbed_official | 237:f3da66175598 | 7179 | |
mbed_official | 237:f3da66175598 | 7180 | switch (OCChannel) |
mbed_official | 237:f3da66175598 | 7181 | { |
mbed_official | 237:f3da66175598 | 7182 | case HRTIM_OUTPUT_TA1: |
mbed_official | 237:f3da66175598 | 7183 | case HRTIM_OUTPUT_TB1: |
mbed_official | 237:f3da66175598 | 7184 | case HRTIM_OUTPUT_TC1: |
mbed_official | 237:f3da66175598 | 7185 | case HRTIM_OUTPUT_TD1: |
mbed_official | 237:f3da66175598 | 7186 | case HRTIM_OUTPUT_TE1: |
mbed_official | 237:f3da66175598 | 7187 | { |
mbed_official | 237:f3da66175598 | 7188 | /* Retreives actual OC mode and set dma_request accordingly */ |
mbed_official | 237:f3da66175598 | 7189 | hrtim_set = hhrtim->Instance->sTimerxRegs[TimerIdx].SETx1R; |
mbed_official | 237:f3da66175598 | 7190 | hrtim_reset = hhrtim->Instance->sTimerxRegs[TimerIdx].RSTx1R; |
mbed_official | 237:f3da66175598 | 7191 | |
mbed_official | 237:f3da66175598 | 7192 | if (((hrtim_set & HRTIM_OUTPUTSET_TIMCMP1) == HRTIM_OUTPUTSET_TIMCMP1) && |
mbed_official | 237:f3da66175598 | 7193 | ((hrtim_reset & HRTIM_OUTPUTSET_TIMCMP1) == HRTIM_OUTPUTSET_TIMCMP1)) |
mbed_official | 237:f3da66175598 | 7194 | { |
mbed_official | 237:f3da66175598 | 7195 | /* OC mode: HRTIM_BASICOCMODE_TOGGLE */ |
mbed_official | 237:f3da66175598 | 7196 | dma_request = HRTIM_TIM_DMA_CMP1; |
mbed_official | 237:f3da66175598 | 7197 | } |
mbed_official | 237:f3da66175598 | 7198 | else if (((hrtim_set & HRTIM_OUTPUTSET_TIMCMP1) == HRTIM_OUTPUTSET_TIMCMP1) && |
mbed_official | 237:f3da66175598 | 7199 | (hrtim_reset == 0)) |
mbed_official | 237:f3da66175598 | 7200 | { |
mbed_official | 237:f3da66175598 | 7201 | /* OC mode: HRTIM_BASICOCMODE_ACTIVE */ |
mbed_official | 237:f3da66175598 | 7202 | dma_request = HRTIM_TIM_DMA_SET1; |
mbed_official | 237:f3da66175598 | 7203 | } |
mbed_official | 237:f3da66175598 | 7204 | else if ((hrtim_set == 0) && |
mbed_official | 237:f3da66175598 | 7205 | ((hrtim_reset & HRTIM_OUTPUTSET_TIMCMP1) == HRTIM_OUTPUTSET_TIMCMP1)) |
mbed_official | 237:f3da66175598 | 7206 | { |
mbed_official | 237:f3da66175598 | 7207 | /* OC mode: HRTIM_BASICOCMODE_INACTIVE */ |
mbed_official | 237:f3da66175598 | 7208 | dma_request = HRTIM_TIM_DMA_RST1; |
mbed_official | 237:f3da66175598 | 7209 | } |
mbed_official | 237:f3da66175598 | 7210 | } |
mbed_official | 237:f3da66175598 | 7211 | break; |
mbed_official | 237:f3da66175598 | 7212 | case HRTIM_OUTPUT_TA2: |
mbed_official | 237:f3da66175598 | 7213 | case HRTIM_OUTPUT_TB2: |
mbed_official | 237:f3da66175598 | 7214 | case HRTIM_OUTPUT_TC2: |
mbed_official | 237:f3da66175598 | 7215 | case HRTIM_OUTPUT_TD2: |
mbed_official | 237:f3da66175598 | 7216 | case HRTIM_OUTPUT_TE2: |
mbed_official | 237:f3da66175598 | 7217 | { |
mbed_official | 237:f3da66175598 | 7218 | /* Retreives actual OC mode and set dma_request accordingly */ |
mbed_official | 237:f3da66175598 | 7219 | hrtim_set = hhrtim->Instance->sTimerxRegs[TimerIdx].SETx2R; |
mbed_official | 237:f3da66175598 | 7220 | hrtim_reset = hhrtim->Instance->sTimerxRegs[TimerIdx].RSTx2R; |
mbed_official | 237:f3da66175598 | 7221 | |
mbed_official | 237:f3da66175598 | 7222 | if (((hrtim_set & HRTIM_OUTPUTSET_TIMCMP2) == HRTIM_OUTPUTSET_TIMCMP2) && |
mbed_official | 237:f3da66175598 | 7223 | ((hrtim_reset & HRTIM_OUTPUTSET_TIMCMP2) == HRTIM_OUTPUTSET_TIMCMP2)) |
mbed_official | 237:f3da66175598 | 7224 | { |
mbed_official | 237:f3da66175598 | 7225 | /* OC mode: HRTIM_BASICOCMODE_TOGGLE */ |
mbed_official | 237:f3da66175598 | 7226 | dma_request = HRTIM_TIM_DMA_CMP2; |
mbed_official | 237:f3da66175598 | 7227 | } |
mbed_official | 237:f3da66175598 | 7228 | else if (((hrtim_set & HRTIM_OUTPUTSET_TIMCMP2) == HRTIM_OUTPUTSET_TIMCMP2) && |
mbed_official | 237:f3da66175598 | 7229 | (hrtim_reset == 0)) |
mbed_official | 237:f3da66175598 | 7230 | { |
mbed_official | 237:f3da66175598 | 7231 | /* OC mode: HRTIM_BASICOCMODE_ACTIVE */ |
mbed_official | 237:f3da66175598 | 7232 | dma_request = HRTIM_TIM_DMA_SET2; |
mbed_official | 237:f3da66175598 | 7233 | } |
mbed_official | 237:f3da66175598 | 7234 | else if ((hrtim_set == 0) && |
mbed_official | 237:f3da66175598 | 7235 | ((hrtim_reset & HRTIM_OUTPUTSET_TIMCMP2) == HRTIM_OUTPUTSET_TIMCMP2)) |
mbed_official | 237:f3da66175598 | 7236 | { |
mbed_official | 237:f3da66175598 | 7237 | /* OC mode: HRTIM_BASICOCMODE_INACTIVE */ |
mbed_official | 237:f3da66175598 | 7238 | dma_request = HRTIM_TIM_DMA_RST2; |
mbed_official | 237:f3da66175598 | 7239 | } |
mbed_official | 237:f3da66175598 | 7240 | } |
mbed_official | 237:f3da66175598 | 7241 | break; |
mbed_official | 237:f3da66175598 | 7242 | } |
mbed_official | 237:f3da66175598 | 7243 | |
mbed_official | 237:f3da66175598 | 7244 | return dma_request; |
mbed_official | 237:f3da66175598 | 7245 | } |
mbed_official | 237:f3da66175598 | 7246 | |
mbed_official | 237:f3da66175598 | 7247 | static DMA_HandleTypeDef * HRTIM_GetDMAHandleFromTimerIdx(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 7248 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 7249 | { |
mbed_official | 237:f3da66175598 | 7250 | DMA_HandleTypeDef * hdma = (DMA_HandleTypeDef *)NULL; |
mbed_official | 237:f3da66175598 | 7251 | |
mbed_official | 237:f3da66175598 | 7252 | switch (TimerIdx) |
mbed_official | 237:f3da66175598 | 7253 | { |
mbed_official | 237:f3da66175598 | 7254 | case HRTIM_TIMERINDEX_MASTER: |
mbed_official | 237:f3da66175598 | 7255 | { |
mbed_official | 237:f3da66175598 | 7256 | hdma = hhrtim->hdmaMaster; |
mbed_official | 237:f3da66175598 | 7257 | } |
mbed_official | 237:f3da66175598 | 7258 | break; |
mbed_official | 237:f3da66175598 | 7259 | case HRTIM_TIMERINDEX_TIMER_A: |
mbed_official | 237:f3da66175598 | 7260 | { |
mbed_official | 237:f3da66175598 | 7261 | hdma = hhrtim->hdmaTimerA; |
mbed_official | 237:f3da66175598 | 7262 | } |
mbed_official | 237:f3da66175598 | 7263 | break; |
mbed_official | 237:f3da66175598 | 7264 | case HRTIM_TIMERINDEX_TIMER_B: |
mbed_official | 237:f3da66175598 | 7265 | { |
mbed_official | 237:f3da66175598 | 7266 | hdma = hhrtim->hdmaTimerB; |
mbed_official | 237:f3da66175598 | 7267 | } |
mbed_official | 237:f3da66175598 | 7268 | break; |
mbed_official | 237:f3da66175598 | 7269 | case HRTIM_TIMERINDEX_TIMER_C: |
mbed_official | 237:f3da66175598 | 7270 | { |
mbed_official | 237:f3da66175598 | 7271 | hdma = hhrtim->hdmaTimerC; |
mbed_official | 237:f3da66175598 | 7272 | } |
mbed_official | 237:f3da66175598 | 7273 | break; |
mbed_official | 237:f3da66175598 | 7274 | case HRTIM_TIMERINDEX_TIMER_D: |
mbed_official | 237:f3da66175598 | 7275 | { |
mbed_official | 237:f3da66175598 | 7276 | hdma = hhrtim->hdmaTimerD; |
mbed_official | 237:f3da66175598 | 7277 | } |
mbed_official | 237:f3da66175598 | 7278 | break; |
mbed_official | 237:f3da66175598 | 7279 | case HRTIM_TIMERINDEX_TIMER_E: |
mbed_official | 237:f3da66175598 | 7280 | { |
mbed_official | 237:f3da66175598 | 7281 | hdma = hhrtim->hdmaTimerE; |
mbed_official | 237:f3da66175598 | 7282 | } |
mbed_official | 237:f3da66175598 | 7283 | break; |
mbed_official | 237:f3da66175598 | 7284 | } |
mbed_official | 237:f3da66175598 | 7285 | |
mbed_official | 237:f3da66175598 | 7286 | return hdma; |
mbed_official | 237:f3da66175598 | 7287 | } |
mbed_official | 237:f3da66175598 | 7288 | |
mbed_official | 237:f3da66175598 | 7289 | static uint32_t GetTimerIdxFromDMAHandle(DMA_HandleTypeDef *hdma) |
mbed_official | 237:f3da66175598 | 7290 | { |
mbed_official | 237:f3da66175598 | 7291 | uint32_t timed_idx = 0xFFFFFFFF; |
mbed_official | 237:f3da66175598 | 7292 | |
mbed_official | 237:f3da66175598 | 7293 | if (hdma->Instance == DMA1_Channel2) |
mbed_official | 237:f3da66175598 | 7294 | { |
mbed_official | 237:f3da66175598 | 7295 | timed_idx = HRTIM_TIMERINDEX_MASTER; |
mbed_official | 237:f3da66175598 | 7296 | } |
mbed_official | 237:f3da66175598 | 7297 | else if (hdma->Instance == DMA1_Channel3) |
mbed_official | 237:f3da66175598 | 7298 | { |
mbed_official | 237:f3da66175598 | 7299 | timed_idx = HRTIM_TIMERINDEX_TIMER_A; |
mbed_official | 237:f3da66175598 | 7300 | } |
mbed_official | 237:f3da66175598 | 7301 | else if (hdma->Instance == DMA1_Channel4) |
mbed_official | 237:f3da66175598 | 7302 | { |
mbed_official | 237:f3da66175598 | 7303 | timed_idx = HRTIM_TIMERINDEX_TIMER_B; |
mbed_official | 237:f3da66175598 | 7304 | } |
mbed_official | 237:f3da66175598 | 7305 | else if (hdma->Instance == DMA1_Channel5) |
mbed_official | 237:f3da66175598 | 7306 | { |
mbed_official | 237:f3da66175598 | 7307 | timed_idx = HRTIM_TIMERINDEX_TIMER_C; |
mbed_official | 237:f3da66175598 | 7308 | } |
mbed_official | 237:f3da66175598 | 7309 | else if (hdma->Instance == DMA1_Channel6) |
mbed_official | 237:f3da66175598 | 7310 | { |
mbed_official | 237:f3da66175598 | 7311 | timed_idx = HRTIM_TIMERINDEX_TIMER_D; |
mbed_official | 237:f3da66175598 | 7312 | } |
mbed_official | 237:f3da66175598 | 7313 | else if (hdma->Instance == DMA1_Channel7) |
mbed_official | 237:f3da66175598 | 7314 | { |
mbed_official | 237:f3da66175598 | 7315 | timed_idx = HRTIM_TIMERINDEX_TIMER_E; |
mbed_official | 237:f3da66175598 | 7316 | } |
mbed_official | 237:f3da66175598 | 7317 | |
mbed_official | 237:f3da66175598 | 7318 | return timed_idx; |
mbed_official | 237:f3da66175598 | 7319 | } |
mbed_official | 237:f3da66175598 | 7320 | |
mbed_official | 237:f3da66175598 | 7321 | /** |
mbed_official | 237:f3da66175598 | 7322 | * @brief Forces an immediate transfer from the preload to the active |
mbed_official | 237:f3da66175598 | 7323 | * registers. |
mbed_official | 237:f3da66175598 | 7324 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 7325 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 7326 | * @retval None |
mbed_official | 237:f3da66175598 | 7327 | */ |
mbed_official | 237:f3da66175598 | 7328 | static void HRTIM_ForceRegistersUpdate(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 7329 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 7330 | { |
mbed_official | 237:f3da66175598 | 7331 | switch (TimerIdx) |
mbed_official | 237:f3da66175598 | 7332 | { |
mbed_official | 237:f3da66175598 | 7333 | case HRTIM_TIMERINDEX_MASTER: |
mbed_official | 237:f3da66175598 | 7334 | { |
mbed_official | 237:f3da66175598 | 7335 | hhrtim->Instance->sCommonRegs.CR2 |= HRTIM_CR2_MSWU; |
mbed_official | 237:f3da66175598 | 7336 | } |
mbed_official | 237:f3da66175598 | 7337 | break; |
mbed_official | 237:f3da66175598 | 7338 | case HRTIM_TIMERINDEX_TIMER_A: |
mbed_official | 237:f3da66175598 | 7339 | { |
mbed_official | 237:f3da66175598 | 7340 | hhrtim->Instance->sCommonRegs.CR2 |= HRTIM_CR2_TASWU; |
mbed_official | 237:f3da66175598 | 7341 | } |
mbed_official | 237:f3da66175598 | 7342 | break; |
mbed_official | 237:f3da66175598 | 7343 | case HRTIM_TIMERINDEX_TIMER_B: |
mbed_official | 237:f3da66175598 | 7344 | { |
mbed_official | 237:f3da66175598 | 7345 | hhrtim->Instance->sCommonRegs.CR2 |= HRTIM_CR2_TBSWU; |
mbed_official | 237:f3da66175598 | 7346 | } |
mbed_official | 237:f3da66175598 | 7347 | break; |
mbed_official | 237:f3da66175598 | 7348 | case HRTIM_TIMERINDEX_TIMER_C: |
mbed_official | 237:f3da66175598 | 7349 | { |
mbed_official | 237:f3da66175598 | 7350 | hhrtim->Instance->sCommonRegs.CR2 |= HRTIM_CR2_TCSWU; |
mbed_official | 237:f3da66175598 | 7351 | } |
mbed_official | 237:f3da66175598 | 7352 | break; |
mbed_official | 237:f3da66175598 | 7353 | case HRTIM_TIMERINDEX_TIMER_D: |
mbed_official | 237:f3da66175598 | 7354 | { |
mbed_official | 237:f3da66175598 | 7355 | hhrtim->Instance->sCommonRegs.CR2 |= HRTIM_CR2_TDSWU; |
mbed_official | 237:f3da66175598 | 7356 | } |
mbed_official | 237:f3da66175598 | 7357 | break; |
mbed_official | 237:f3da66175598 | 7358 | case HRTIM_TIMERINDEX_TIMER_E: |
mbed_official | 237:f3da66175598 | 7359 | { |
mbed_official | 237:f3da66175598 | 7360 | hhrtim->Instance->sCommonRegs.CR2 |= HRTIM_CR2_TESWU; |
mbed_official | 237:f3da66175598 | 7361 | } |
mbed_official | 237:f3da66175598 | 7362 | break; |
mbed_official | 237:f3da66175598 | 7363 | } |
mbed_official | 237:f3da66175598 | 7364 | } |
mbed_official | 237:f3da66175598 | 7365 | |
mbed_official | 237:f3da66175598 | 7366 | |
mbed_official | 237:f3da66175598 | 7367 | /** |
mbed_official | 237:f3da66175598 | 7368 | * @brief HRTIM interrupts service routine |
mbed_official | 237:f3da66175598 | 7369 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 7370 | * @retval None |
mbed_official | 237:f3da66175598 | 7371 | */ |
mbed_official | 237:f3da66175598 | 7372 | static void HRTIM_HRTIM_ISR(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 7373 | { |
mbed_official | 237:f3da66175598 | 7374 | /* Fault 1 event */ |
mbed_official | 237:f3da66175598 | 7375 | if(__HAL_HRTIM_GET_FLAG(hhrtim, HRTIM_FLAG_FLT1) != RESET) |
mbed_official | 237:f3da66175598 | 7376 | { |
mbed_official | 237:f3da66175598 | 7377 | if(__HAL_HRTIM_GET_ITSTATUS(hhrtim, HRTIM_IT_FLT1) != RESET) |
mbed_official | 237:f3da66175598 | 7378 | { |
mbed_official | 237:f3da66175598 | 7379 | __HAL_HRTIM_CLEAR_IT(hhrtim, HRTIM_IT_FLT1); |
mbed_official | 237:f3da66175598 | 7380 | |
mbed_official | 237:f3da66175598 | 7381 | /* Invoke Fault 1 event callback */ |
mbed_official | 237:f3da66175598 | 7382 | HAL_HRTIM_Fault1Callback(hhrtim); |
mbed_official | 237:f3da66175598 | 7383 | } |
mbed_official | 237:f3da66175598 | 7384 | } |
mbed_official | 237:f3da66175598 | 7385 | |
mbed_official | 237:f3da66175598 | 7386 | /* Fault 2 event */ |
mbed_official | 237:f3da66175598 | 7387 | if(__HAL_HRTIM_GET_FLAG(hhrtim, HRTIM_FLAG_FLT2) != RESET) |
mbed_official | 237:f3da66175598 | 7388 | { |
mbed_official | 237:f3da66175598 | 7389 | if(__HAL_HRTIM_GET_ITSTATUS(hhrtim, HRTIM_IT_FLT2) != RESET) |
mbed_official | 237:f3da66175598 | 7390 | { |
mbed_official | 237:f3da66175598 | 7391 | __HAL_HRTIM_CLEAR_IT(hhrtim, HRTIM_IT_FLT2); |
mbed_official | 237:f3da66175598 | 7392 | |
mbed_official | 237:f3da66175598 | 7393 | /* Invoke Fault 2 event callback */ |
mbed_official | 237:f3da66175598 | 7394 | HAL_HRTIM_Fault2Callback(hhrtim); |
mbed_official | 237:f3da66175598 | 7395 | } |
mbed_official | 237:f3da66175598 | 7396 | } |
mbed_official | 237:f3da66175598 | 7397 | |
mbed_official | 237:f3da66175598 | 7398 | /* Fault 3 event */ |
mbed_official | 237:f3da66175598 | 7399 | if(__HAL_HRTIM_GET_FLAG(hhrtim, HRTIM_FLAG_FLT3) != RESET) |
mbed_official | 237:f3da66175598 | 7400 | { |
mbed_official | 237:f3da66175598 | 7401 | if(__HAL_HRTIM_GET_ITSTATUS(hhrtim, HRTIM_IT_FLT3) != RESET) |
mbed_official | 237:f3da66175598 | 7402 | { |
mbed_official | 237:f3da66175598 | 7403 | __HAL_HRTIM_CLEAR_IT(hhrtim, HRTIM_IT_FLT3); |
mbed_official | 237:f3da66175598 | 7404 | |
mbed_official | 237:f3da66175598 | 7405 | /* Invoke Fault 3 event callback */ |
mbed_official | 237:f3da66175598 | 7406 | HAL_HRTIM_Fault3Callback(hhrtim); |
mbed_official | 237:f3da66175598 | 7407 | } |
mbed_official | 237:f3da66175598 | 7408 | } |
mbed_official | 237:f3da66175598 | 7409 | |
mbed_official | 237:f3da66175598 | 7410 | /* Fault 4 event */ |
mbed_official | 237:f3da66175598 | 7411 | if(__HAL_HRTIM_GET_FLAG(hhrtim, HRTIM_FLAG_FLT4) != RESET) |
mbed_official | 237:f3da66175598 | 7412 | { |
mbed_official | 237:f3da66175598 | 7413 | if(__HAL_HRTIM_GET_ITSTATUS(hhrtim, HRTIM_IT_FLT4) != RESET) |
mbed_official | 237:f3da66175598 | 7414 | { |
mbed_official | 237:f3da66175598 | 7415 | __HAL_HRTIM_CLEAR_IT(hhrtim, HRTIM_IT_FLT4); |
mbed_official | 237:f3da66175598 | 7416 | |
mbed_official | 237:f3da66175598 | 7417 | /* Invoke Fault 4 event callback */ |
mbed_official | 237:f3da66175598 | 7418 | HAL_HRTIM_Fault4Callback(hhrtim); |
mbed_official | 237:f3da66175598 | 7419 | } |
mbed_official | 237:f3da66175598 | 7420 | } |
mbed_official | 237:f3da66175598 | 7421 | |
mbed_official | 237:f3da66175598 | 7422 | /* Fault 5 event */ |
mbed_official | 237:f3da66175598 | 7423 | if(__HAL_HRTIM_GET_FLAG(hhrtim, HRTIM_FLAG_FLT5) != RESET) |
mbed_official | 237:f3da66175598 | 7424 | { |
mbed_official | 237:f3da66175598 | 7425 | if(__HAL_HRTIM_GET_ITSTATUS(hhrtim, HRTIM_IT_FLT5) != RESET) |
mbed_official | 237:f3da66175598 | 7426 | { |
mbed_official | 237:f3da66175598 | 7427 | __HAL_HRTIM_CLEAR_IT(hhrtim, HRTIM_IT_FLT5); |
mbed_official | 237:f3da66175598 | 7428 | |
mbed_official | 237:f3da66175598 | 7429 | /* Invoke Fault 5 event callback */ |
mbed_official | 237:f3da66175598 | 7430 | HAL_HRTIM_Fault5Callback(hhrtim); |
mbed_official | 237:f3da66175598 | 7431 | } |
mbed_official | 237:f3da66175598 | 7432 | } |
mbed_official | 237:f3da66175598 | 7433 | |
mbed_official | 237:f3da66175598 | 7434 | /* System fault event */ |
mbed_official | 237:f3da66175598 | 7435 | if(__HAL_HRTIM_GET_FLAG(hhrtim, HRTIM_FLAG_SYSFLT) != RESET) |
mbed_official | 237:f3da66175598 | 7436 | { |
mbed_official | 237:f3da66175598 | 7437 | if(__HAL_HRTIM_GET_ITSTATUS(hhrtim, HRTIM_IT_SYSFLT) != RESET) |
mbed_official | 237:f3da66175598 | 7438 | { |
mbed_official | 237:f3da66175598 | 7439 | __HAL_HRTIM_CLEAR_IT(hhrtim, HRTIM_IT_SYSFLT); |
mbed_official | 237:f3da66175598 | 7440 | |
mbed_official | 237:f3da66175598 | 7441 | /* Invoke System fault event callback */ |
mbed_official | 237:f3da66175598 | 7442 | HAL_HRTIM_SystemFaultCallback(hhrtim); |
mbed_official | 237:f3da66175598 | 7443 | } |
mbed_official | 237:f3da66175598 | 7444 | } |
mbed_official | 237:f3da66175598 | 7445 | } |
mbed_official | 237:f3da66175598 | 7446 | |
mbed_official | 237:f3da66175598 | 7447 | /** |
mbed_official | 237:f3da66175598 | 7448 | * @brief Master timer interrupts service routine |
mbed_official | 237:f3da66175598 | 7449 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 7450 | * @retval None |
mbed_official | 237:f3da66175598 | 7451 | */ |
mbed_official | 237:f3da66175598 | 7452 | static void HRTIM_Master_ISR(HRTIM_HandleTypeDef * hhrtim) |
mbed_official | 237:f3da66175598 | 7453 | { |
mbed_official | 237:f3da66175598 | 7454 | /* DLL calibration ready event */ |
mbed_official | 237:f3da66175598 | 7455 | if(__HAL_HRTIM_GET_FLAG(hhrtim, HRTIM_FLAG_DLLRDY) != RESET) |
mbed_official | 237:f3da66175598 | 7456 | { |
mbed_official | 237:f3da66175598 | 7457 | if(__HAL_HRTIM_GET_ITSTATUS(hhrtim, HRTIM_IT_DLLRDY) != RESET) |
mbed_official | 237:f3da66175598 | 7458 | { |
mbed_official | 237:f3da66175598 | 7459 | __HAL_HRTIM_CLEAR_IT(hhrtim, HRTIM_IT_DLLRDY); |
mbed_official | 237:f3da66175598 | 7460 | |
mbed_official | 237:f3da66175598 | 7461 | /* Set HRTIM State */ |
mbed_official | 237:f3da66175598 | 7462 | hhrtim->State = HAL_HRTIM_STATE_READY; |
mbed_official | 237:f3da66175598 | 7463 | |
mbed_official | 237:f3da66175598 | 7464 | /* Process unlocked */ |
mbed_official | 237:f3da66175598 | 7465 | __HAL_UNLOCK(hhrtim); |
mbed_official | 237:f3da66175598 | 7466 | |
mbed_official | 237:f3da66175598 | 7467 | /* Invoke System fault event callback */ |
mbed_official | 237:f3da66175598 | 7468 | HAL_HRTIM_DLLCalbrationReadyCallback(hhrtim); |
mbed_official | 237:f3da66175598 | 7469 | } |
mbed_official | 237:f3da66175598 | 7470 | } |
mbed_official | 237:f3da66175598 | 7471 | |
mbed_official | 237:f3da66175598 | 7472 | /* Burst mode period event */ |
mbed_official | 237:f3da66175598 | 7473 | if(__HAL_HRTIM_GET_FLAG(hhrtim, HRTIM_FLAG_BMPER) != RESET) |
mbed_official | 237:f3da66175598 | 7474 | { |
mbed_official | 237:f3da66175598 | 7475 | if(__HAL_HRTIM_GET_ITSTATUS(hhrtim, HRTIM_IT_BMPER) != RESET) |
mbed_official | 237:f3da66175598 | 7476 | { |
mbed_official | 237:f3da66175598 | 7477 | __HAL_HRTIM_CLEAR_IT(hhrtim, HRTIM_IT_BMPER); |
mbed_official | 237:f3da66175598 | 7478 | |
mbed_official | 237:f3da66175598 | 7479 | /* Invoke Burst mode period event callback */ |
mbed_official | 237:f3da66175598 | 7480 | HAL_HRTIM_BurstModePeriodCallback(hhrtim); |
mbed_official | 237:f3da66175598 | 7481 | } |
mbed_official | 237:f3da66175598 | 7482 | } |
mbed_official | 237:f3da66175598 | 7483 | |
mbed_official | 237:f3da66175598 | 7484 | /* Master timer compare 1 event */ |
mbed_official | 237:f3da66175598 | 7485 | if(__HAL_HRTIM_MASTER_GET_FLAG(hhrtim, HRTIM_MASTER_FLAG_MCMP1) != RESET) |
mbed_official | 237:f3da66175598 | 7486 | { |
mbed_official | 237:f3da66175598 | 7487 | if(__HAL_HRTIM_MASTER_GET_ITSTATUS(hhrtim, HRTIM_MASTER_IT_MCMP1) != RESET) |
mbed_official | 237:f3da66175598 | 7488 | { |
mbed_official | 237:f3da66175598 | 7489 | __HAL_HRTIM_MASTER_CLEAR_IT(hhrtim, HRTIM_MASTER_IT_MCMP1); |
mbed_official | 237:f3da66175598 | 7490 | |
mbed_official | 237:f3da66175598 | 7491 | /* Invoke compare 1 event callback */ |
mbed_official | 237:f3da66175598 | 7492 | HAL_HRTIM_Compare1EventCallback(hhrtim, HRTIM_TIMERINDEX_MASTER); |
mbed_official | 237:f3da66175598 | 7493 | } |
mbed_official | 237:f3da66175598 | 7494 | } |
mbed_official | 237:f3da66175598 | 7495 | |
mbed_official | 237:f3da66175598 | 7496 | /* Master timer compare 2 event */ |
mbed_official | 237:f3da66175598 | 7497 | if(__HAL_HRTIM_MASTER_GET_FLAG(hhrtim, HRTIM_MASTER_FLAG_MCMP2) != RESET) |
mbed_official | 237:f3da66175598 | 7498 | { |
mbed_official | 237:f3da66175598 | 7499 | if(__HAL_HRTIM_MASTER_GET_ITSTATUS(hhrtim, HRTIM_MASTER_IT_MCMP2) != RESET) |
mbed_official | 237:f3da66175598 | 7500 | { |
mbed_official | 237:f3da66175598 | 7501 | __HAL_HRTIM_MASTER_CLEAR_IT(hhrtim, HRTIM_MASTER_IT_MCMP2); |
mbed_official | 237:f3da66175598 | 7502 | |
mbed_official | 237:f3da66175598 | 7503 | /* Invoke compare 2 event callback */ |
mbed_official | 237:f3da66175598 | 7504 | HAL_HRTIM_Compare2EventCallback(hhrtim, HRTIM_TIMERINDEX_MASTER); |
mbed_official | 237:f3da66175598 | 7505 | } |
mbed_official | 237:f3da66175598 | 7506 | } |
mbed_official | 237:f3da66175598 | 7507 | |
mbed_official | 237:f3da66175598 | 7508 | /* Master timer compare 3 event */ |
mbed_official | 237:f3da66175598 | 7509 | if(__HAL_HRTIM_MASTER_GET_FLAG(hhrtim, HRTIM_MASTER_FLAG_MCMP3) != RESET) |
mbed_official | 237:f3da66175598 | 7510 | { |
mbed_official | 237:f3da66175598 | 7511 | if(__HAL_HRTIM_MASTER_GET_ITSTATUS(hhrtim, HRTIM_MASTER_IT_MCMP3) != RESET) |
mbed_official | 237:f3da66175598 | 7512 | { |
mbed_official | 237:f3da66175598 | 7513 | __HAL_HRTIM_MASTER_CLEAR_IT(hhrtim, HRTIM_MASTER_IT_MCMP3); |
mbed_official | 237:f3da66175598 | 7514 | |
mbed_official | 237:f3da66175598 | 7515 | /* Invoke compare 3 event callback */ |
mbed_official | 237:f3da66175598 | 7516 | HAL_HRTIM_Compare3EventCallback(hhrtim, HRTIM_TIMERINDEX_MASTER); |
mbed_official | 237:f3da66175598 | 7517 | } |
mbed_official | 237:f3da66175598 | 7518 | } |
mbed_official | 237:f3da66175598 | 7519 | |
mbed_official | 237:f3da66175598 | 7520 | /* Master timer compare 4 event */ |
mbed_official | 237:f3da66175598 | 7521 | if(__HAL_HRTIM_MASTER_GET_FLAG(hhrtim, HRTIM_MASTER_FLAG_MCMP4) != RESET) |
mbed_official | 237:f3da66175598 | 7522 | { |
mbed_official | 237:f3da66175598 | 7523 | if(__HAL_HRTIM_MASTER_GET_ITSTATUS(hhrtim, HRTIM_MASTER_IT_MCMP4) != RESET) |
mbed_official | 237:f3da66175598 | 7524 | { |
mbed_official | 237:f3da66175598 | 7525 | __HAL_HRTIM_MASTER_CLEAR_IT(hhrtim, HRTIM_MASTER_IT_MCMP4); |
mbed_official | 237:f3da66175598 | 7526 | |
mbed_official | 237:f3da66175598 | 7527 | /* Invoke compare 4 event callback */ |
mbed_official | 237:f3da66175598 | 7528 | HAL_HRTIM_Compare4EventCallback(hhrtim, HRTIM_TIMERINDEX_MASTER); |
mbed_official | 237:f3da66175598 | 7529 | } |
mbed_official | 237:f3da66175598 | 7530 | } |
mbed_official | 237:f3da66175598 | 7531 | |
mbed_official | 237:f3da66175598 | 7532 | /* Master timer repetition event */ |
mbed_official | 237:f3da66175598 | 7533 | if(__HAL_HRTIM_MASTER_GET_FLAG(hhrtim, HRTIM_MASTER_FLAG_MREP) != RESET) |
mbed_official | 237:f3da66175598 | 7534 | { |
mbed_official | 237:f3da66175598 | 7535 | if(__HAL_HRTIM_MASTER_GET_ITSTATUS(hhrtim, HRTIM_MASTER_IT_MREP) != RESET) |
mbed_official | 237:f3da66175598 | 7536 | { |
mbed_official | 237:f3da66175598 | 7537 | __HAL_HRTIM_MASTER_CLEAR_IT(hhrtim, HRTIM_MASTER_IT_MREP); |
mbed_official | 237:f3da66175598 | 7538 | |
mbed_official | 237:f3da66175598 | 7539 | /* Invoke repetition event callback */ |
mbed_official | 237:f3da66175598 | 7540 | HAL_HRTIM_RepetitionEventCallback(hhrtim, HRTIM_TIMERINDEX_MASTER); |
mbed_official | 237:f3da66175598 | 7541 | } |
mbed_official | 237:f3da66175598 | 7542 | } |
mbed_official | 237:f3da66175598 | 7543 | |
mbed_official | 237:f3da66175598 | 7544 | /* Synchronization input event */ |
mbed_official | 237:f3da66175598 | 7545 | if(__HAL_HRTIM_MASTER_GET_FLAG(hhrtim, HRTIM_MASTER_FLAG_SYNC) != RESET) |
mbed_official | 237:f3da66175598 | 7546 | { |
mbed_official | 237:f3da66175598 | 7547 | if(__HAL_HRTIM_MASTER_GET_ITSTATUS(hhrtim, HRTIM_MASTER_IT_SYNC) != RESET) |
mbed_official | 237:f3da66175598 | 7548 | { |
mbed_official | 237:f3da66175598 | 7549 | __HAL_HRTIM_MASTER_CLEAR_IT(hhrtim, HRTIM_MASTER_IT_SYNC); |
mbed_official | 237:f3da66175598 | 7550 | |
mbed_official | 237:f3da66175598 | 7551 | /* Invoke synchronization event callback */ |
mbed_official | 237:f3da66175598 | 7552 | HAL_HRTIM_SynchronizationEventCallback(hhrtim); |
mbed_official | 237:f3da66175598 | 7553 | } |
mbed_official | 237:f3da66175598 | 7554 | } |
mbed_official | 237:f3da66175598 | 7555 | |
mbed_official | 237:f3da66175598 | 7556 | /* Master timer registers update event */ |
mbed_official | 237:f3da66175598 | 7557 | if(__HAL_HRTIM_MASTER_GET_FLAG(hhrtim, HRTIM_MASTER_FLAG_MUPD) != RESET) |
mbed_official | 237:f3da66175598 | 7558 | { |
mbed_official | 237:f3da66175598 | 7559 | if(__HAL_HRTIM_MASTER_GET_ITSTATUS(hhrtim, HRTIM_MASTER_IT_MUPD) != RESET) |
mbed_official | 237:f3da66175598 | 7560 | { |
mbed_official | 237:f3da66175598 | 7561 | __HAL_HRTIM_MASTER_CLEAR_IT(hhrtim, HRTIM_MASTER_IT_MUPD); |
mbed_official | 237:f3da66175598 | 7562 | |
mbed_official | 237:f3da66175598 | 7563 | /* Invoke registers update event callback */ |
mbed_official | 237:f3da66175598 | 7564 | HAL_HRTIM_RegistersUpdateCallback(hhrtim, HRTIM_TIMERINDEX_MASTER); |
mbed_official | 237:f3da66175598 | 7565 | } |
mbed_official | 237:f3da66175598 | 7566 | } |
mbed_official | 237:f3da66175598 | 7567 | } |
mbed_official | 237:f3da66175598 | 7568 | |
mbed_official | 237:f3da66175598 | 7569 | /** |
mbed_official | 237:f3da66175598 | 7570 | * @brief Timer interrupts service routine |
mbed_official | 237:f3da66175598 | 7571 | * @param hhrtim: pointer to HAL HRTIM handle |
mbed_official | 237:f3da66175598 | 7572 | * @param TimerIdx: Timer index |
mbed_official | 237:f3da66175598 | 7573 | * This parameter can be one of the following values: |
mbed_official | 237:f3da66175598 | 7574 | * @arg HRTIM_TIMERINDEX_TIMER_A for timer A |
mbed_official | 237:f3da66175598 | 7575 | * @arg HRTIM_TIMERINDEX_TIMER_B for timer B |
mbed_official | 237:f3da66175598 | 7576 | * @arg HRTIM_TIMERINDEX_TIMER_C for timer C |
mbed_official | 237:f3da66175598 | 7577 | * @arg HRTIM_TIMERINDEX_TIMER_D for timer D |
mbed_official | 237:f3da66175598 | 7578 | * @arg HRTIM_TIMERINDEX_TIMER_E for timer E |
mbed_official | 237:f3da66175598 | 7579 | * @retval None |
mbed_official | 237:f3da66175598 | 7580 | */ |
mbed_official | 237:f3da66175598 | 7581 | static void HRTIM_Timer_ISR(HRTIM_HandleTypeDef * hhrtim, |
mbed_official | 237:f3da66175598 | 7582 | uint32_t TimerIdx) |
mbed_official | 237:f3da66175598 | 7583 | { |
mbed_official | 237:f3da66175598 | 7584 | /* Timer compare 1 event */ |
mbed_official | 237:f3da66175598 | 7585 | if(__HAL_HRTIM_TIMER_GET_FLAG(hhrtim, TimerIdx, HRTIM_TIM_FLAG_CMP1) != RESET) |
mbed_official | 237:f3da66175598 | 7586 | { |
mbed_official | 237:f3da66175598 | 7587 | if(__HAL_HRTIM_TIMER_GET_ITSTATUS(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP1) != RESET) |
mbed_official | 237:f3da66175598 | 7588 | { |
mbed_official | 237:f3da66175598 | 7589 | __HAL_HRTIM_TIMER_CLEAR_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP1); |
mbed_official | 237:f3da66175598 | 7590 | |
mbed_official | 237:f3da66175598 | 7591 | /* Invoke compare 1 event callback */ |
mbed_official | 237:f3da66175598 | 7592 | HAL_HRTIM_Compare1EventCallback(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 7593 | } |
mbed_official | 237:f3da66175598 | 7594 | } |
mbed_official | 237:f3da66175598 | 7595 | |
mbed_official | 237:f3da66175598 | 7596 | /* Timer compare 2 event */ |
mbed_official | 237:f3da66175598 | 7597 | if(__HAL_HRTIM_TIMER_GET_FLAG(hhrtim, TimerIdx, HRTIM_TIM_FLAG_CMP2) != RESET) |
mbed_official | 237:f3da66175598 | 7598 | { |
mbed_official | 237:f3da66175598 | 7599 | if(__HAL_HRTIM_TIMER_GET_ITSTATUS(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP2) != RESET) |
mbed_official | 237:f3da66175598 | 7600 | { |
mbed_official | 237:f3da66175598 | 7601 | __HAL_HRTIM_TIMER_CLEAR_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP2); |
mbed_official | 237:f3da66175598 | 7602 | |
mbed_official | 237:f3da66175598 | 7603 | /* Invoke compare 2 event callback */ |
mbed_official | 237:f3da66175598 | 7604 | HAL_HRTIM_Compare2EventCallback(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 7605 | } |
mbed_official | 237:f3da66175598 | 7606 | } |
mbed_official | 237:f3da66175598 | 7607 | |
mbed_official | 237:f3da66175598 | 7608 | /* Timer compare 3 event */ |
mbed_official | 237:f3da66175598 | 7609 | if(__HAL_HRTIM_TIMER_GET_FLAG(hhrtim, TimerIdx, HRTIM_TIM_FLAG_CMP3) != RESET) |
mbed_official | 237:f3da66175598 | 7610 | { |
mbed_official | 237:f3da66175598 | 7611 | if(__HAL_HRTIM_TIMER_GET_ITSTATUS(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP3) != RESET) |
mbed_official | 237:f3da66175598 | 7612 | { |
mbed_official | 237:f3da66175598 | 7613 | __HAL_HRTIM_TIMER_CLEAR_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP3); |
mbed_official | 237:f3da66175598 | 7614 | |
mbed_official | 237:f3da66175598 | 7615 | /* Invoke compare 3 event callback */ |
mbed_official | 237:f3da66175598 | 7616 | HAL_HRTIM_Compare3EventCallback(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 7617 | } |
mbed_official | 237:f3da66175598 | 7618 | } |
mbed_official | 237:f3da66175598 | 7619 | |
mbed_official | 237:f3da66175598 | 7620 | /* Timer compare 4 event */ |
mbed_official | 237:f3da66175598 | 7621 | if(__HAL_HRTIM_TIMER_GET_FLAG(hhrtim, TimerIdx, HRTIM_TIM_FLAG_CMP4) != RESET) |
mbed_official | 237:f3da66175598 | 7622 | { |
mbed_official | 237:f3da66175598 | 7623 | if(__HAL_HRTIM_TIMER_GET_ITSTATUS(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP4) != RESET) |
mbed_official | 237:f3da66175598 | 7624 | { |
mbed_official | 237:f3da66175598 | 7625 | __HAL_HRTIM_TIMER_CLEAR_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CMP4); |
mbed_official | 237:f3da66175598 | 7626 | |
mbed_official | 237:f3da66175598 | 7627 | /* Invoke compare 4 event callback */ |
mbed_official | 237:f3da66175598 | 7628 | HAL_HRTIM_Compare4EventCallback(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 7629 | } |
mbed_official | 237:f3da66175598 | 7630 | } |
mbed_official | 237:f3da66175598 | 7631 | |
mbed_official | 237:f3da66175598 | 7632 | /* Timer repetition event */ |
mbed_official | 237:f3da66175598 | 7633 | if(__HAL_HRTIM_TIMER_GET_FLAG(hhrtim, TimerIdx, HRTIM_TIM_FLAG_REP) != RESET) |
mbed_official | 237:f3da66175598 | 7634 | { |
mbed_official | 237:f3da66175598 | 7635 | if(__HAL_HRTIM_TIMER_GET_ITSTATUS(hhrtim, TimerIdx, HRTIM_TIM_IT_REP) != RESET) |
mbed_official | 237:f3da66175598 | 7636 | { |
mbed_official | 237:f3da66175598 | 7637 | __HAL_HRTIM_TIMER_CLEAR_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_REP); |
mbed_official | 237:f3da66175598 | 7638 | |
mbed_official | 237:f3da66175598 | 7639 | /* Invoke repetition event callback */ |
mbed_official | 237:f3da66175598 | 7640 | HAL_HRTIM_RepetitionEventCallback(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 7641 | } |
mbed_official | 237:f3da66175598 | 7642 | } |
mbed_official | 237:f3da66175598 | 7643 | |
mbed_official | 237:f3da66175598 | 7644 | /* Timer registers update event */ |
mbed_official | 237:f3da66175598 | 7645 | if(__HAL_HRTIM_TIMER_GET_FLAG(hhrtim, TimerIdx, HRTIM_TIM_FLAG_UPD) != RESET) |
mbed_official | 237:f3da66175598 | 7646 | { |
mbed_official | 237:f3da66175598 | 7647 | if(__HAL_HRTIM_TIMER_GET_ITSTATUS(hhrtim, TimerIdx, HRTIM_TIM_IT_UPD) != RESET) |
mbed_official | 237:f3da66175598 | 7648 | { |
mbed_official | 237:f3da66175598 | 7649 | __HAL_HRTIM_TIMER_CLEAR_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_UPD); |
mbed_official | 237:f3da66175598 | 7650 | |
mbed_official | 237:f3da66175598 | 7651 | /* Invoke registers update event callback */ |
mbed_official | 237:f3da66175598 | 7652 | HAL_HRTIM_RegistersUpdateCallback(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 7653 | } |
mbed_official | 237:f3da66175598 | 7654 | } |
mbed_official | 237:f3da66175598 | 7655 | |
mbed_official | 237:f3da66175598 | 7656 | /* Timer capture 1 event */ |
mbed_official | 237:f3da66175598 | 7657 | if(__HAL_HRTIM_TIMER_GET_FLAG(hhrtim, TimerIdx, HRTIM_TIM_FLAG_CPT1) != RESET) |
mbed_official | 237:f3da66175598 | 7658 | { |
mbed_official | 237:f3da66175598 | 7659 | if(__HAL_HRTIM_TIMER_GET_ITSTATUS(hhrtim, TimerIdx, HRTIM_TIM_IT_CPT1) != RESET) |
mbed_official | 237:f3da66175598 | 7660 | { |
mbed_official | 237:f3da66175598 | 7661 | __HAL_HRTIM_TIMER_CLEAR_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CPT1); |
mbed_official | 237:f3da66175598 | 7662 | |
mbed_official | 237:f3da66175598 | 7663 | /* Invoke capture 1 event callback */ |
mbed_official | 237:f3da66175598 | 7664 | HAL_HRTIM_Capture1EventCallback(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 7665 | } |
mbed_official | 237:f3da66175598 | 7666 | } |
mbed_official | 237:f3da66175598 | 7667 | |
mbed_official | 237:f3da66175598 | 7668 | /* Timer capture 2 event */ |
mbed_official | 237:f3da66175598 | 7669 | if(__HAL_HRTIM_TIMER_GET_FLAG(hhrtim, TimerIdx, HRTIM_TIM_FLAG_CPT2) != RESET) |
mbed_official | 237:f3da66175598 | 7670 | { |
mbed_official | 237:f3da66175598 | 7671 | if(__HAL_HRTIM_TIMER_GET_ITSTATUS(hhrtim, TimerIdx, HRTIM_TIM_IT_CPT2) != RESET) |
mbed_official | 237:f3da66175598 | 7672 | { |
mbed_official | 237:f3da66175598 | 7673 | __HAL_HRTIM_TIMER_CLEAR_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_CPT2); |
mbed_official | 237:f3da66175598 | 7674 | |
mbed_official | 237:f3da66175598 | 7675 | /* Invoke capture 2 event callback */ |
mbed_official | 237:f3da66175598 | 7676 | HAL_HRTIM_Capture2EventCallback(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 7677 | } |
mbed_official | 237:f3da66175598 | 7678 | } |
mbed_official | 237:f3da66175598 | 7679 | |
mbed_official | 237:f3da66175598 | 7680 | /* Timer ouput 1 set event */ |
mbed_official | 237:f3da66175598 | 7681 | if(__HAL_HRTIM_TIMER_GET_FLAG(hhrtim, TimerIdx, HRTIM_TIM_FLAG_SET1) != RESET) |
mbed_official | 237:f3da66175598 | 7682 | { |
mbed_official | 237:f3da66175598 | 7683 | if(__HAL_HRTIM_TIMER_GET_ITSTATUS(hhrtim, TimerIdx, HRTIM_TIM_IT_SET1) != RESET) |
mbed_official | 237:f3da66175598 | 7684 | { |
mbed_official | 237:f3da66175598 | 7685 | __HAL_HRTIM_TIMER_CLEAR_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_SET1); |
mbed_official | 237:f3da66175598 | 7686 | |
mbed_official | 237:f3da66175598 | 7687 | /* Invoke ouput 1 set event callback */ |
mbed_official | 237:f3da66175598 | 7688 | HAL_HRTIM_Output1SetCallback(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 7689 | } |
mbed_official | 237:f3da66175598 | 7690 | } |
mbed_official | 237:f3da66175598 | 7691 | |
mbed_official | 237:f3da66175598 | 7692 | /* Timer ouput 1 reset event */ |
mbed_official | 237:f3da66175598 | 7693 | if(__HAL_HRTIM_TIMER_GET_FLAG(hhrtim, TimerIdx, HRTIM_TIM_FLAG_RST1) != RESET) |
mbed_official | 237:f3da66175598 | 7694 | { |
mbed_official | 237:f3da66175598 | 7695 | if(__HAL_HRTIM_TIMER_GET_ITSTATUS(hhrtim, TimerIdx, HRTIM_TIM_IT_RST1) != RESET) |
mbed_official | 237:f3da66175598 | 7696 | { |
mbed_official | 237:f3da66175598 | 7697 | __HAL_HRTIM_TIMER_CLEAR_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_RST1); |
mbed_official | 237:f3da66175598 | 7698 | |
mbed_official | 237:f3da66175598 | 7699 | /* Invoke ouput 1 reset event callback */ |
mbed_official | 237:f3da66175598 | 7700 | HAL_HRTIM_Output1ResetCallback(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 7701 | } |
mbed_official | 237:f3da66175598 | 7702 | } |
mbed_official | 237:f3da66175598 | 7703 | |
mbed_official | 237:f3da66175598 | 7704 | /* Timer ouput 2 set event */ |
mbed_official | 237:f3da66175598 | 7705 | if(__HAL_HRTIM_TIMER_GET_FLAG(hhrtim, TimerIdx, HRTIM_TIM_FLAG_SET2) != RESET) |
mbed_official | 237:f3da66175598 | 7706 | { |
mbed_official | 237:f3da66175598 | 7707 | if(__HAL_HRTIM_TIMER_GET_ITSTATUS(hhrtim, TimerIdx, HRTIM_TIM_IT_SET2) != RESET) |
mbed_official | 237:f3da66175598 | 7708 | { |
mbed_official | 237:f3da66175598 | 7709 | __HAL_HRTIM_TIMER_CLEAR_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_SET2); |
mbed_official | 237:f3da66175598 | 7710 | |
mbed_official | 237:f3da66175598 | 7711 | /* Invoke ouput 2 set event callback */ |
mbed_official | 237:f3da66175598 | 7712 | HAL_HRTIM_Output2SetCallback(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 7713 | } |
mbed_official | 237:f3da66175598 | 7714 | } |
mbed_official | 237:f3da66175598 | 7715 | |
mbed_official | 237:f3da66175598 | 7716 | /* Timer ouput 2 reset event */ |
mbed_official | 237:f3da66175598 | 7717 | if(__HAL_HRTIM_TIMER_GET_FLAG(hhrtim, TimerIdx, HRTIM_TIM_FLAG_RST2) != RESET) |
mbed_official | 237:f3da66175598 | 7718 | { |
mbed_official | 237:f3da66175598 | 7719 | if(__HAL_HRTIM_TIMER_GET_ITSTATUS(hhrtim, TimerIdx, HRTIM_TIM_IT_RST2) != RESET) |
mbed_official | 237:f3da66175598 | 7720 | { |
mbed_official | 237:f3da66175598 | 7721 | __HAL_HRTIM_TIMER_CLEAR_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_RST2); |
mbed_official | 237:f3da66175598 | 7722 | |
mbed_official | 237:f3da66175598 | 7723 | /* Invoke ouput 2 reset event callback */ |
mbed_official | 237:f3da66175598 | 7724 | HAL_HRTIM_Output2ResetCallback(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 7725 | } |
mbed_official | 237:f3da66175598 | 7726 | } |
mbed_official | 237:f3da66175598 | 7727 | |
mbed_official | 237:f3da66175598 | 7728 | /* Timer reset event */ |
mbed_official | 237:f3da66175598 | 7729 | if(__HAL_HRTIM_TIMER_GET_FLAG(hhrtim, TimerIdx, HRTIM_TIM_FLAG_RST) != RESET) |
mbed_official | 237:f3da66175598 | 7730 | { |
mbed_official | 237:f3da66175598 | 7731 | if(__HAL_HRTIM_TIMER_GET_ITSTATUS(hhrtim, TimerIdx, HRTIM_TIM_IT_RST) != RESET) |
mbed_official | 237:f3da66175598 | 7732 | { |
mbed_official | 237:f3da66175598 | 7733 | __HAL_HRTIM_TIMER_CLEAR_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_RST); |
mbed_official | 237:f3da66175598 | 7734 | |
mbed_official | 237:f3da66175598 | 7735 | /* Invoke timer reset callback */ |
mbed_official | 237:f3da66175598 | 7736 | HAL_HRTIM_CounterResetCallback(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 7737 | } |
mbed_official | 237:f3da66175598 | 7738 | } |
mbed_official | 237:f3da66175598 | 7739 | |
mbed_official | 237:f3da66175598 | 7740 | /* Delayed protection event */ |
mbed_official | 237:f3da66175598 | 7741 | if(__HAL_HRTIM_TIMER_GET_FLAG(hhrtim, TimerIdx, HRTIM_TIM_FLAG_DLYPRT) != RESET) |
mbed_official | 237:f3da66175598 | 7742 | { |
mbed_official | 237:f3da66175598 | 7743 | if(__HAL_HRTIM_TIMER_GET_ITSTATUS(hhrtim, TimerIdx, HRTIM_TIM_IT_DLYPRT) != RESET) |
mbed_official | 237:f3da66175598 | 7744 | { |
mbed_official | 237:f3da66175598 | 7745 | __HAL_HRTIM_TIMER_CLEAR_IT(hhrtim, TimerIdx, HRTIM_TIM_IT_DLYPRT); |
mbed_official | 237:f3da66175598 | 7746 | |
mbed_official | 237:f3da66175598 | 7747 | /* Invoke delayed protection callback */ |
mbed_official | 237:f3da66175598 | 7748 | HAL_HRTIM_DelayedProtectionCallback(hhrtim, TimerIdx); |
mbed_official | 237:f3da66175598 | 7749 | } |
mbed_official | 237:f3da66175598 | 7750 | } |
mbed_official | 237:f3da66175598 | 7751 | } |
mbed_official | 237:f3da66175598 | 7752 | |
mbed_official | 237:f3da66175598 | 7753 | /** |
mbed_official | 237:f3da66175598 | 7754 | * @brief DMA callback invoked upon master timer related DMA request completion |
mbed_official | 237:f3da66175598 | 7755 | * @param hdma: pointer to DMA handle. |
mbed_official | 237:f3da66175598 | 7756 | * @retval None |
mbed_official | 237:f3da66175598 | 7757 | */ |
mbed_official | 237:f3da66175598 | 7758 | static void HRTIM_DMAMasterCplt(DMA_HandleTypeDef *hdma) |
mbed_official | 237:f3da66175598 | 7759 | { |
mbed_official | 237:f3da66175598 | 7760 | HRTIM_HandleTypeDef * hrtim = (HRTIM_HandleTypeDef *)((DMA_HandleTypeDef* )hdma)->Parent; |
mbed_official | 237:f3da66175598 | 7761 | |
mbed_official | 237:f3da66175598 | 7762 | if ((hrtim->Instance->sMasterRegs.MDIER & HRTIM_MASTER_DMA_MCMP1) != RESET) |
mbed_official | 237:f3da66175598 | 7763 | { |
mbed_official | 237:f3da66175598 | 7764 | HAL_HRTIM_Compare1EventCallback(hrtim, HRTIM_TIMERINDEX_MASTER); |
mbed_official | 237:f3da66175598 | 7765 | } |
mbed_official | 237:f3da66175598 | 7766 | else if ((hrtim->Instance->sMasterRegs.MDIER & HRTIM_MASTER_DMA_MCMP2) != RESET) |
mbed_official | 237:f3da66175598 | 7767 | { |
mbed_official | 237:f3da66175598 | 7768 | HAL_HRTIM_Compare2EventCallback(hrtim, HRTIM_TIMERINDEX_MASTER); |
mbed_official | 237:f3da66175598 | 7769 | } |
mbed_official | 237:f3da66175598 | 7770 | else if ((hrtim->Instance->sMasterRegs.MDIER & HRTIM_MASTER_DMA_MCMP3) != RESET) |
mbed_official | 237:f3da66175598 | 7771 | { |
mbed_official | 237:f3da66175598 | 7772 | HAL_HRTIM_Compare3EventCallback(hrtim, HRTIM_TIMERINDEX_MASTER); |
mbed_official | 237:f3da66175598 | 7773 | } |
mbed_official | 237:f3da66175598 | 7774 | else if ((hrtim->Instance->sMasterRegs.MDIER & HRTIM_MASTER_DMA_MCMP4) != RESET) |
mbed_official | 237:f3da66175598 | 7775 | { |
mbed_official | 237:f3da66175598 | 7776 | HAL_HRTIM_Compare4EventCallback(hrtim, HRTIM_TIMERINDEX_MASTER); |
mbed_official | 237:f3da66175598 | 7777 | } |
mbed_official | 237:f3da66175598 | 7778 | else if ((hrtim->Instance->sMasterRegs.MDIER & HRTIM_MASTER_DMA_MREP) != RESET) |
mbed_official | 237:f3da66175598 | 7779 | { |
mbed_official | 237:f3da66175598 | 7780 | HAL_HRTIM_RepetitionEventCallback(hrtim, HRTIM_TIMERINDEX_MASTER); |
mbed_official | 237:f3da66175598 | 7781 | } |
mbed_official | 237:f3da66175598 | 7782 | else if ((hrtim->Instance->sMasterRegs.MDIER & HRTIM_MASTER_DMA_SYNC) != RESET) |
mbed_official | 237:f3da66175598 | 7783 | { |
mbed_official | 237:f3da66175598 | 7784 | HAL_HRTIM_SynchronizationEventCallback(hrtim); |
mbed_official | 237:f3da66175598 | 7785 | } |
mbed_official | 237:f3da66175598 | 7786 | else if ((hrtim->Instance->sMasterRegs.MDIER & HRTIM_MASTER_DMA_MUPD) != RESET) |
mbed_official | 237:f3da66175598 | 7787 | { |
mbed_official | 237:f3da66175598 | 7788 | HAL_HRTIM_RegistersUpdateCallback(hrtim, HRTIM_TIMERINDEX_MASTER); |
mbed_official | 237:f3da66175598 | 7789 | } |
mbed_official | 237:f3da66175598 | 7790 | } |
mbed_official | 237:f3da66175598 | 7791 | |
mbed_official | 237:f3da66175598 | 7792 | /** |
mbed_official | 237:f3da66175598 | 7793 | * @brief DMA callback invoked upon timer A..E related DMA request completion |
mbed_official | 237:f3da66175598 | 7794 | * @param hdma: pointer to DMA handle. |
mbed_official | 237:f3da66175598 | 7795 | * @retval None |
mbed_official | 237:f3da66175598 | 7796 | */ |
mbed_official | 237:f3da66175598 | 7797 | static void HRTIM_DMATimerxCplt(DMA_HandleTypeDef *hdma) |
mbed_official | 237:f3da66175598 | 7798 | { |
mbed_official | 237:f3da66175598 | 7799 | uint8_t timer_idx; |
mbed_official | 237:f3da66175598 | 7800 | |
mbed_official | 237:f3da66175598 | 7801 | HRTIM_HandleTypeDef * hrtim = (HRTIM_HandleTypeDef *)((DMA_HandleTypeDef* )hdma)->Parent; |
mbed_official | 237:f3da66175598 | 7802 | |
mbed_official | 237:f3da66175598 | 7803 | timer_idx = GetTimerIdxFromDMAHandle(hdma); |
mbed_official | 237:f3da66175598 | 7804 | |
mbed_official | 237:f3da66175598 | 7805 | if ((hrtim->Instance->sTimerxRegs[timer_idx].TIMxDIER & HRTIM_TIM_DMA_CMP1) != RESET) |
mbed_official | 237:f3da66175598 | 7806 | { |
mbed_official | 237:f3da66175598 | 7807 | HAL_HRTIM_Compare1EventCallback(hrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 7808 | } |
mbed_official | 237:f3da66175598 | 7809 | else if ((hrtim->Instance->sTimerxRegs[timer_idx].TIMxDIER & HRTIM_TIM_DMA_CMP2) != RESET) |
mbed_official | 237:f3da66175598 | 7810 | { |
mbed_official | 237:f3da66175598 | 7811 | HAL_HRTIM_Compare2EventCallback(hrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 7812 | } |
mbed_official | 237:f3da66175598 | 7813 | else if ((hrtim->Instance->sTimerxRegs[timer_idx].TIMxDIER & HRTIM_TIM_DMA_CMP3) != RESET) |
mbed_official | 237:f3da66175598 | 7814 | { |
mbed_official | 237:f3da66175598 | 7815 | HAL_HRTIM_Compare3EventCallback(hrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 7816 | } |
mbed_official | 237:f3da66175598 | 7817 | else if ((hrtim->Instance->sTimerxRegs[timer_idx].TIMxDIER & HRTIM_TIM_DMA_CMP4) != RESET) |
mbed_official | 237:f3da66175598 | 7818 | { |
mbed_official | 237:f3da66175598 | 7819 | HAL_HRTIM_Compare4EventCallback(hrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 7820 | } |
mbed_official | 237:f3da66175598 | 7821 | else if ((hrtim->Instance->sTimerxRegs[timer_idx].TIMxDIER & HRTIM_TIM_DMA_REP) != RESET) |
mbed_official | 237:f3da66175598 | 7822 | { |
mbed_official | 237:f3da66175598 | 7823 | HAL_HRTIM_RepetitionEventCallback(hrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 7824 | } |
mbed_official | 237:f3da66175598 | 7825 | else if ((hrtim->Instance->sTimerxRegs[timer_idx].TIMxDIER & HRTIM_TIM_DMA_UPD) != RESET) |
mbed_official | 237:f3da66175598 | 7826 | { |
mbed_official | 237:f3da66175598 | 7827 | HAL_HRTIM_RegistersUpdateCallback(hrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 7828 | } |
mbed_official | 237:f3da66175598 | 7829 | else if ((hrtim->Instance->sTimerxRegs[timer_idx].TIMxDIER & HRTIM_TIM_DMA_CPT1) != RESET) |
mbed_official | 237:f3da66175598 | 7830 | { |
mbed_official | 237:f3da66175598 | 7831 | HAL_HRTIM_Capture1EventCallback(hrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 7832 | } |
mbed_official | 237:f3da66175598 | 7833 | else if ((hrtim->Instance->sTimerxRegs[timer_idx].TIMxDIER & HRTIM_TIM_DMA_CPT2) != RESET) |
mbed_official | 237:f3da66175598 | 7834 | { |
mbed_official | 237:f3da66175598 | 7835 | HAL_HRTIM_Capture2EventCallback(hrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 7836 | } |
mbed_official | 237:f3da66175598 | 7837 | else if ((hrtim->Instance->sTimerxRegs[timer_idx].TIMxDIER & HRTIM_TIM_DMA_SET1) != RESET) |
mbed_official | 237:f3da66175598 | 7838 | { |
mbed_official | 237:f3da66175598 | 7839 | HAL_HRTIM_Output1SetCallback(hrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 7840 | } |
mbed_official | 237:f3da66175598 | 7841 | else if ((hrtim->Instance->sTimerxRegs[timer_idx].TIMxDIER & HRTIM_TIM_DMA_RST1) != RESET) |
mbed_official | 237:f3da66175598 | 7842 | { |
mbed_official | 237:f3da66175598 | 7843 | HAL_HRTIM_Output1ResetCallback(hrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 7844 | } |
mbed_official | 237:f3da66175598 | 7845 | else if ((hrtim->Instance->sTimerxRegs[timer_idx].TIMxDIER & HRTIM_TIM_DMA_SET2) != RESET) |
mbed_official | 237:f3da66175598 | 7846 | { |
mbed_official | 237:f3da66175598 | 7847 | HAL_HRTIM_Output2SetCallback(hrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 7848 | } |
mbed_official | 237:f3da66175598 | 7849 | else if ((hrtim->Instance->sTimerxRegs[timer_idx].TIMxDIER & HRTIM_TIM_DMA_RST2) != RESET) |
mbed_official | 237:f3da66175598 | 7850 | { |
mbed_official | 237:f3da66175598 | 7851 | HAL_HRTIM_Output2ResetCallback(hrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 7852 | } |
mbed_official | 237:f3da66175598 | 7853 | else if ((hrtim->Instance->sTimerxRegs[timer_idx].TIMxDIER & HRTIM_TIM_DMA_RST) != RESET) |
mbed_official | 237:f3da66175598 | 7854 | { |
mbed_official | 237:f3da66175598 | 7855 | HAL_HRTIM_CounterResetCallback(hrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 7856 | } |
mbed_official | 237:f3da66175598 | 7857 | else if ((hrtim->Instance->sTimerxRegs[timer_idx].TIMxDIER & HRTIM_TIM_DMA_DLYPRT) != RESET) |
mbed_official | 237:f3da66175598 | 7858 | { |
mbed_official | 237:f3da66175598 | 7859 | HAL_HRTIM_DelayedProtectionCallback(hrtim, timer_idx); |
mbed_official | 237:f3da66175598 | 7860 | } |
mbed_official | 237:f3da66175598 | 7861 | } |
mbed_official | 237:f3da66175598 | 7862 | |
mbed_official | 237:f3da66175598 | 7863 | /** |
mbed_official | 237:f3da66175598 | 7864 | * @brief DMA error callback |
mbed_official | 237:f3da66175598 | 7865 | * @param hdma: pointer to DMA handle. |
mbed_official | 237:f3da66175598 | 7866 | * @retval None |
mbed_official | 237:f3da66175598 | 7867 | */ |
mbed_official | 237:f3da66175598 | 7868 | static void HRTIM_DMAError(DMA_HandleTypeDef *hdma) |
mbed_official | 237:f3da66175598 | 7869 | { |
mbed_official | 237:f3da66175598 | 7870 | HRTIM_HandleTypeDef * hrtim = (HRTIM_HandleTypeDef *)((DMA_HandleTypeDef* )hdma)->Parent; |
mbed_official | 237:f3da66175598 | 7871 | |
mbed_official | 237:f3da66175598 | 7872 | HAL_HRTIM_ErrorCallback(hrtim); |
mbed_official | 237:f3da66175598 | 7873 | } |
mbed_official | 237:f3da66175598 | 7874 | |
mbed_official | 237:f3da66175598 | 7875 | /** |
mbed_official | 237:f3da66175598 | 7876 | * @brief DMA callback invoked upon burst DMA transfer completion |
mbed_official | 237:f3da66175598 | 7877 | * @param hdma: pointer to DMA handle. |
mbed_official | 237:f3da66175598 | 7878 | * @retval None |
mbed_official | 237:f3da66175598 | 7879 | */ |
mbed_official | 237:f3da66175598 | 7880 | static void HRTIM_BurstDMACplt(DMA_HandleTypeDef *hdma) |
mbed_official | 237:f3da66175598 | 7881 | { |
mbed_official | 237:f3da66175598 | 7882 | HRTIM_HandleTypeDef * hrtim = (HRTIM_HandleTypeDef *)((DMA_HandleTypeDef* )hdma)->Parent; |
mbed_official | 237:f3da66175598 | 7883 | |
mbed_official | 237:f3da66175598 | 7884 | HAL_HRTIM_BurstDMATransferCallback(hrtim, GetTimerIdxFromDMAHandle(hdma)); |
mbed_official | 237:f3da66175598 | 7885 | } |
mbed_official | 237:f3da66175598 | 7886 | |
mbed_official | 237:f3da66175598 | 7887 | /** |
mbed_official | 237:f3da66175598 | 7888 | * @} |
mbed_official | 237:f3da66175598 | 7889 | */ |
mbed_official | 237:f3da66175598 | 7890 | |
mbed_official | 237:f3da66175598 | 7891 | #endif /* STM32F334x8 */ |
mbed_official | 237:f3da66175598 | 7892 | |
mbed_official | 237:f3da66175598 | 7893 | #endif /* HAL_HRTIM_MODULE_ENABLED */ |
mbed_official | 237:f3da66175598 | 7894 | /** |
mbed_official | 237:f3da66175598 | 7895 | * @} |
mbed_official | 237:f3da66175598 | 7896 | */ |
mbed_official | 237:f3da66175598 | 7897 | |
mbed_official | 237:f3da66175598 | 7898 | /** |
mbed_official | 237:f3da66175598 | 7899 | * @} |
mbed_official | 237:f3da66175598 | 7900 | */ |
mbed_official | 237:f3da66175598 | 7901 | |
mbed_official | 237:f3da66175598 | 7902 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
mbed_official | 237:f3da66175598 | 7903 | |
mbed_official | 237:f3da66175598 | 7904 | |
mbed_official | 237:f3da66175598 | 7905 |