PWM driver implementation for STM32F4 series (Cortex-M4). More...
#include "core/cortex-m4/pwm.h"
#include "core/cortex-m4/clock.h"
#include "core/cortex-m4/timer.h"
#include <stdint.h>
Functions | |
void | hal_pwm_init (PWM_Handle *pwm, uint32_t frequency, float dutyCycle) |
Initialize PWM with a specified frequency and duty cycle. | |
void | hal_pwm_start (PWM_Handle *pwm) |
Start PWM output. | |
void | hal_pwm_stop (PWM_Handle *pwm) |
Stop PWM output. | |
void | hal_pwm_set_duty_cycle (PWM_Handle *pwm, float dutyCycle) |
Set PWM duty cycle. | |
void | hal_pwm_set_frequency (PWM_Handle *pwm, uint32_t frequency) |
Set PWM frequency. |
PWM driver implementation for STM32F4 series (Cortex-M4).
void hal_pwm_init | ( | PWM_Handle * | pwm, |
uint32_t | frequency, | ||
float | dutyCycle ) |
Initialize PWM with a specified frequency and duty cycle.
Initialize a PWM handle with the specified frequency and duty cycle.
This function configures the timer to generate a PWM signal on the specified channel with the given frequency and duty cycle.
pwm | Pointer to the PWM handle structure. |
frequency | Desired PWM frequency in Hz. |
dutyCycle | Duty cycle as a fraction (0.0f - 1.0f). |
void hal_pwm_set_duty_cycle | ( | PWM_Handle * | pwm, |
float | dutyCycle ) |
Set PWM duty cycle.
Set the PWM duty cycle.
pwm | Pointer to the PWM handle structure. |
dutyCycle | New duty cycle as a fraction (0.0f - 1.0f). |
void hal_pwm_set_frequency | ( | PWM_Handle * | pwm, |
uint32_t | frequency ) |
Set PWM frequency.
Set the PWM frequency.
pwm | Pointer to the PWM handle structure. |
frequency | Desired PWM frequency in Hz. |
void hal_pwm_start | ( | PWM_Handle * | pwm | ) |
Start PWM output.
Start PWM signal generation.
pwm | Pointer to the PWM handle structure. |
void hal_pwm_stop | ( | PWM_Handle * | pwm | ) |
Stop PWM output.
Stop PWM signal generation.
This function disables the timer channel and stops the timer.
pwm | Pointer to the PWM handle structure. |