|
PER Firmware
|
Public PWM driver interface for STM32G4. More...
Functions | |
| bool | PHAL_PWM_init (TIM_TypeDef *tim, uint32_t frequency_hz, uint8_t channels_en) |
| Initialize consecutive PWM channels beginning at channel 1. | |
| bool | PHAL_PWM_setPercent (TIM_TypeDef *tim, uint8_t channel, uint8_t percent) |
| Set a PWM channel's duty cycle. | |
Public PWM driver interface for STM32G4.
| bool PHAL_PWM_init | ( | TIM_TypeDef * | tim, |
| uint32_t | frequency_hz, | ||
| uint8_t | channels_en ) |
Initialize consecutive PWM channels beginning at channel 1.
Configures the selected timer to generate PWM at the requested frequency and enables channels 1 through channels_en.
| tim | Timer peripheral. |
| frequency_hz | Requested PWM frequency. |
| channels_en | Channels to enable. |
Auto-reload value providing 100 duty-cycle steps.
Number of timer counts in one PWM period.
Divisor needed to produce the requested PWM frequency.
Required timer clock divider.
Prescalar register value corresponding to the clock divider.
| bool PHAL_PWM_setPercent | ( | TIM_TypeDef * | tim, |
| uint8_t | channel, | ||
| uint8_t | percent ) |
Set a PWM channel's duty cycle.
| tim | Timer peripheral. |
| channel | Specific channel to set duty cycle of. |
| percent | Duty cycle percentage to set, 0-100. |
Configured timer auto-reload value.
Capture/compare value corresponding to requested duty cycle.