HAL interface for PWM (Pulse Width Modulation) configuration and control.
More...
#include "utils/timer_types.h"
#include <stdint.h>
Go to the source code of this file.
HAL interface for PWM (Pulse Width Modulation) configuration and control.
This header provides:
- PWM handle structure linking hardware timers and channels.
- Functions to initialize, start, stop, and configure PWM signals.
- Copyright
- © NAVROBOTEC PVT. LTD.
◆ hal_pwm_init()
void hal_pwm_init |
( |
PWM_Handle * | pwm, |
|
|
uint32_t | frequency, |
|
|
float | dutyCycle ) |
Initialize a PWM handle with the specified frequency and duty cycle.
- Parameters
-
pwm | Pointer to the PWM handle. |
frequency | PWM frequency in Hz. |
dutyCycle | Duty cycle as a percentage (0.0 to 100.0). |
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.
- Parameters
-
pwm | Pointer to the PWM handle structure. |
frequency | Desired PWM frequency in Hz. |
dutyCycle | Duty cycle as a fraction (0.0f - 1.0f). |
◆ hal_pwm_set_duty_cycle()
void hal_pwm_set_duty_cycle |
( |
PWM_Handle * | pwm, |
|
|
float | dutyCycle ) |
Set the PWM duty cycle.
- Parameters
-
pwm | Pointer to the PWM handle. |
dutyCycle | Duty cycle as a percentage (0.0 to 100.0). |
Set the PWM duty cycle.
- Parameters
-
pwm | Pointer to the PWM handle structure. |
dutyCycle | New duty cycle as a fraction (0.0f - 1.0f). |
◆ hal_pwm_set_frequency()
void hal_pwm_set_frequency |
( |
PWM_Handle * | pwm, |
|
|
uint32_t | frequency ) |
Set the PWM frequency.
- Parameters
-
pwm | Pointer to the PWM handle. |
frequency | PWM frequency in Hz. |
Set the PWM frequency.
- Note
- This function is not yet implemented.
- Parameters
-
pwm | Pointer to the PWM handle structure. |
frequency | Desired PWM frequency in Hz. |
◆ hal_pwm_start()
Start PWM signal generation.
- Parameters
-
pwm | Pointer to the PWM handle. |
Start PWM signal generation.
- Parameters
-
pwm | Pointer to the PWM handle structure. |
◆ hal_pwm_stop()
Stop PWM signal generation.
- Parameters
-
pwm | Pointer to the PWM handle. |
Stop PWM signal generation.
This function disables the timer channel and stops the timer.
- Parameters
-
pwm | Pointer to the PWM handle structure. |