HARMcksL: ARM HAL toolbox (yet STM32 oriented) 1.6
SMFSW collection of HAL hacks for STM32
Loading...
Searching...
No Matches
PWM.h File Reference

Straightforward PWM handling. More...

#include "sarmfsw.h"
Include dependency graph for PWM.h:
This graph shows which files directly or indirectly include this file:

Functions

HAL_StatusTypeDef init_PWM_Chan (TIM_HandleTypeDef *const pTim, const uint32_t chan, const uint16_t freq, const eState start_polarity)
 Init TIM PWM module channel with frequency and starts the channel.
 
HAL_StatusTypeDef set_PWM_Output (TIM_HandleTypeDef *const pTim, const uint32_t chan, const bool on)
 Set PWM channel output on/off.
 
HAL_StatusTypeDef set_PWM_Duty_Scaled (const TIM_HandleTypeDef *const pTim, const uint32_t chan, const uint32_t duty, const uint32_t scale)
 Set TIM module PWM duty cycle (scaled)
 
HAL_StatusTypeDef set_PWM_Duty_Word (const TIM_HandleTypeDef *const pTim, const uint32_t chan, const uint16_t duty)
 Set TIM module PWM duty cycle (u16 value)
 
HAL_StatusTypeDef set_PWM_Duty_Byte (const TIM_HandleTypeDef *const pTim, const uint32_t chan, const uint8_t duty)
 Set TIM module PWM duty cycle (u8 value)
 
HAL_StatusTypeDef set_PWM_Duty_Perc (const TIM_HandleTypeDef *const pTim, const uint32_t chan, const uint8_t duty)
 Set TIM module PWM duty cycle (percents)
 

Detailed Description

Straightforward PWM handling.

Author
SMFSW
Warning
Init functions assume that TIM peripherals instance were already configured by HAL

Function Documentation

◆ init_PWM_Chan()

HAL_StatusTypeDef init_PWM_Chan ( TIM_HandleTypeDef *const pTim,
const uint32_t chan,
const uint16_t freq,
const eState start_polarity )

Init TIM PWM module channel with frequency and starts the channel.

Parameters
[in,out]pTim- pointer to TIM instance for PWM generation
[in]chan- Channel to write
[in]freq- Desired PWM frequency
[in]start_polarity- Set PWM output to 100% at init if set to On (0% otherwise)
Returns
HAL Status
Here is the call graph for this function:

◆ set_PWM_Duty_Byte()

HAL_StatusTypeDef set_PWM_Duty_Byte ( const TIM_HandleTypeDef *const pTim,
const uint32_t chan,
const uint8_t duty )
inline

Set TIM module PWM duty cycle (u8 value)

Parameters
[in,out]pTim- pointer to TIM instance for PWM generation
[in]chan- Channel to write
[in]duty- 8b duty cycle value to write
Returns
HAL Status
Here is the call graph for this function:

◆ set_PWM_Duty_Perc()

HAL_StatusTypeDef set_PWM_Duty_Perc ( const TIM_HandleTypeDef *const pTim,
const uint32_t chan,
const uint8_t duty )
inline

Set TIM module PWM duty cycle (percents)

Parameters
[in,out]pTim- pointer to TIM instance for PWM generation
[in]chan- Channel to write
[in]duty- Percent duty cycle value to write
Returns
HAL Status
Here is the call graph for this function:

◆ set_PWM_Duty_Scaled()

HAL_StatusTypeDef set_PWM_Duty_Scaled ( const TIM_HandleTypeDef *const pTim,
const uint32_t chan,
const uint32_t duty,
const uint32_t scale )

Set TIM module PWM duty cycle (scaled)

Parameters
[in,out]pTim- pointer to TIM instance for PWM generation
[in]chan- Channel to write
[in]duty- Scaled duty cycle value to write
[in]scale- Full scale value
Returns
HAL Status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_PWM_Duty_Word()

HAL_StatusTypeDef set_PWM_Duty_Word ( const TIM_HandleTypeDef *const pTim,
const uint32_t chan,
const uint16_t duty )
inline

Set TIM module PWM duty cycle (u16 value)

Parameters
[in,out]pTim- pointer to TIM instance for PWM generation
[in]chan- Channel to write
[in]duty- 16b duty cycle value to write
Returns
HAL Status
Here is the call graph for this function:

◆ set_PWM_Output()

HAL_StatusTypeDef set_PWM_Output ( TIM_HandleTypeDef *const pTim,
const uint32_t chan,
const bool on )
inline

Set PWM channel output on/off.

Parameters
[in,out]pTim- pointer to TIM instance for PWM generation
[in]chan- Channel to write
[in]on- Channel Output state 0: off, 1: on
Returns
HAL Status
Here is the caller graph for this function: