|
HARMcksL: ARM HAL toolbox (yet STM32 oriented) 1.6
SMFSW collection of HAL hacks for STM32
|
PWM Input Capture handling. More...
#include "sarmfsw.h"

Data Structures | |
| struct | PWM_IC |
| PWM input capture structure. More... | |
Functions | |
| GPIO_PinState | PWM_IC_get_Pin_State_Callback (const uint8_t idx) |
| PWM Input Capture get Pin state (in case of timeout, or at startup) | |
| FctERR | init_PWM_IC (PWM_IC *const pPWM_IC, TIM_HandleTypeDef *const pTim, const uint32_t Direct_Channel, const uint32_t Indirect_Channel, const uint32_t Scale) |
| Init PWM Input Capture channel. | |
| uint32_t | get_PWM_IC_Freq (PWM_IC *const pPWM_IC) |
| Get current PWM Input Capture frequency. | |
| uint32_t | get_PWM_IC_DutyCycle (PWM_IC *const pPWM_IC) |
| Get current PWM Input Capture duty cycle. | |
| void | PWM_IC_handler (void) |
| PWM Input Capture handler. | |
Variables | |
| PWM_IC | PWMin [1] |
PWM Input Capture handling.
PWM_IC input configuration: TIM with multiple channels with slave mode capability shall be used
Slave Mode: Reset Mode Trigger: TI1FP1/TI2FP2 (depending physical MCU pin used tied to channel 1 or 2) Channel tied to pin: Input Capture direct mode Channel (2nd one): Input Capture indirect mode
Prescaler & CLK div: 0, No CLK div Counter Period: max possible value Counter Mode: Up Auto-Reload Preload: Disabled Trigger Output parameters: Disabled Input Capture Channel tied to pin: Rising Edge, Direct, No CLK div Input Capture Channel (2nd one): Falling Edge, Indirect, No CLK div
Instead, CubeMX Combined channels capture may be configured to PWM input capture, avoiding manual timer configuration
GPIO configuration: Alternate Function Push Pull ; Pull Up (if needed) ; High Speed may be recommended
NVIC configuration: Enable interrupt(s) if PWM_IC_NO_IT is not defined at project level
NB_PWM_IC symbol with number of inputs at project level to use PWM_IC functionalities PWM_IC_NO_IT symbol at project level to disable TIM interrupts driven capture PWM_IC_NO_IT symbol) | uint32_t get_PWM_IC_DutyCycle | ( | PWM_IC *const | pPWM_IC | ) |
Get current PWM Input Capture duty cycle.
| [in] | pPWM_IC | - pointer to PWM_IC instance |
| uint32_t get_PWM_IC_Freq | ( | PWM_IC *const | pPWM_IC | ) |
Get current PWM Input Capture frequency.
| [in] | pPWM_IC | - pointer to PWM_IC instance |
| FctERR init_PWM_IC | ( | PWM_IC *const | pPWM_IC, |
| TIM_HandleTypeDef *const | pTim, | ||
| const uint32_t | Direct_Channel, | ||
| const uint32_t | Indirect_Channel, | ||
| const uint32_t | Scale ) |
Init PWM Input Capture channel.
| [in,out] | pPWM_IC | - pointer to PWM input capture instance |
| [in,out] | pTim | - pointer to TIM instance |
| [in] | Direct_Channel | - Direct Channel used for PWM input capture |
| [in] | Indirect_Channel | - Indirect Channel used for PWM input capture |
| [in] | Scale | - PWM input capture duty cycle output scale |

| GPIO_PinState PWM_IC_get_Pin_State_Callback | ( | const uint8_t | idx | ) |
PWM Input Capture get Pin state (in case of timeout, or at startup)
| [in] | idx | - PWM_IC instance index |
| void PWM_IC_handler | ( | void | ) |
PWM Input Capture handler.
|
extern |