HARMcksL: ARM HAL toolbox (yet STM32 oriented) 1.6
SMFSW collection of HAL hacks for STM32
|
GPIO PWM emulation handling. More...
#include "sarmfsw.h"
Data Structures | |
struct | PWM_GPIO |
Software PWM on GPIO struct. More... | |
Typedefs | |
typedef volatile struct PWM_GPIO | PWM_GPIO |
Functions | |
FctERR | PWM_GPIO_setPin (PWM_GPIO *const pPWM, GPIO_TypeDef *const GPIOx, const uint16_t GPIO_Pin, const bool polarity) |
Set channel pin & polarity for emulated PWM channel. | |
FctERR | PWM_GPIO_setFreq (PWM_GPIO *const pPWM, TIM_HandleTypeDef *const pTim, const uint16_t freq, uint16_t granularity) |
Set channel frequency for emulated PWM channel. | |
FctERR | PWM_GPIO_setDuty (PWM_GPIO *const pPWM, const uint16_t val) |
Set new duty cycle for emulated PWM channel. | |
uint16_t | PWM_GPIO_getFreq (const PWM_GPIO *const pPWM) |
Get channel frequency for emulated PWM channel. | |
uint16_t | PWM_GPIO_getDutyCycle (const PWM_GPIO *const pPWM) |
Get channel Duty Cycle for emulated PWM channel. | |
void | PWM_GPIO_handler (PWM_GPIO *const pPWM) |
Handler for an emulated PWM channel. | |
GPIO PWM emulation handling.
PWM_GPIO configuration: TIM with enabled period callback interrupt shall be used (as time base for PWM emulation)
typedef volatile struct PWM_GPIO PWM_GPIO |
|
inline |
Get channel Duty Cycle for emulated PWM channel.
[in,out] | pPWM | - pointer to emulated PWM channel |
|
inline |
Get channel frequency for emulated PWM channel.
[in,out] | pPWM | - pointer to emulated PWM channel |
void PWM_GPIO_handler | ( | PWM_GPIO *const | pPWM | ) |
Handler for an emulated PWM channel.
[in,out] | pPWM | - pointer to emulated PWM channel |
FctERR PWM_GPIO_setDuty | ( | PWM_GPIO *const | pPWM, |
const uint16_t | val ) |
Set new duty cycle for emulated PWM channel.
[in,out] | pPWM | - pointer to emulated PWM channel |
[in] | val | - Duty cycle to apply |
FctERR PWM_GPIO_setFreq | ( | PWM_GPIO *const | pPWM, |
TIM_HandleTypeDef *const | pTim, | ||
const uint16_t | freq, | ||
uint16_t | granularity ) |
Set channel frequency for emulated PWM channel.
[in,out] | pPWM | - pointer to emulated PWM channel |
[in,out] | pTim | - pointer to TIM instance for Frequency computation |
[in] | freq | - PWM frequency to apply |
[in] | granularity | - PWM duty cycle granularity |
FctERR PWM_GPIO_setPin | ( | PWM_GPIO *const | pPWM, |
GPIO_TypeDef *const | GPIOx, | ||
const uint16_t | GPIO_Pin, | ||
const bool | polarity ) |
Set channel pin & polarity for emulated PWM channel.
[in] | GPIOx | - port for emulated PWM |
[in] | GPIO_Pin | - pin for emulated PWM |
[in,out] | pPWM | - pointer to emulated PWM channel |
[in] | polarity | - 0: low polarity, 1: high polarity |