CH32 PWM 驱动实现 / CH32 PWM driver implementation.
More...
#include <ch32_pwm.hpp>
|
|
| CH32PWM (TIM_TypeDef *tim, uint16_t channel, bool active_high, GPIO_TypeDef *gpio, uint16_t pin, uint32_t pin_remap=0, bool complementary=false) |
| | 构造 PWM 对象 / Construct PWM object
|
| |
| ErrorCode | SetDutyCycle (float value) override |
| | Sets the duty cycle of the PWM signal. 设置 PWM 信号的占空比。
|
| |
| ErrorCode | SetConfig (Configuration config) override |
| | Configures the PWM settings. 配置 PWM 参数。
|
| |
| ErrorCode | Enable () override |
| | Enables the PWM output. 启用 PWM 输出。
|
| |
| ErrorCode | Disable () override |
| | Disables the PWM output. 禁用 PWM 输出。
|
| |
|
|
void | ApplyCompare (uint32_t pulse) |
| |
|
void | OcInitForChannel (uint32_t pulse) |
| |
|
void | EnableChannel (bool en) |
| |
|
void | EnableChannelN (bool en) |
| |
|
void | ConfigureGPIO () |
| |
|
|
static bool | IsAdvancedTimer (TIM_TypeDef *t) |
| |
|
static bool | OnAPB2 (TIM_TypeDef *t) |
| |
|
static uint32_t | GetTimerClockHz (TIM_TypeDef *t) |
| |
| static uint32_t | ReadARR32 (TIM_TypeDef *t) |
| |
|
static void | EnableGPIOClock (GPIO_TypeDef *gpio) |
| | 时钟与 GPIO 初始化辅助 / Clock and GPIO configuration helpers
|
| |
|
static void | EnableTIMClock (TIM_TypeDef *tim) |
| |
CH32 PWM 驱动实现 / CH32 PWM driver implementation.
Definition at line 12 of file ch32_pwm.hpp.
◆ Disable()
| ErrorCode LibXR::CH32PWM::Disable |
( |
| ) |
|
|
overridevirtual |
Disables the PWM output. 禁用 PWM 输出。
- Returns
- ErrorCode indicating success or failure. 返回操作结果的错误码。
Implements LibXR::PWM.
◆ Enable()
| ErrorCode LibXR::CH32PWM::Enable |
( |
| ) |
|
|
overridevirtual |
Enables the PWM output. 启用 PWM 输出。
- Returns
- ErrorCode indicating success or failure. 返回操作结果的错误码。
Implements LibXR::PWM.
◆ ReadARR32()
| static uint32_t LibXR::CH32PWM::ReadARR32 |
( |
TIM_TypeDef * | t | ) |
|
|
inlinestaticprivate |
◆ SetConfig()
Configures the PWM settings. 配置 PWM 参数。
- Parameters
-
| config | The configuration structure containing PWM settings. 配置结构体,包含 PWM 设置。 |
- Returns
- ErrorCode indicating success or failure. 返回操作结果的错误码。
Implements LibXR::PWM.
◆ SetDutyCycle()
| ErrorCode LibXR::CH32PWM::SetDutyCycle |
( |
float | value | ) |
|
|
overridevirtual |
Sets the duty cycle of the PWM signal. 设置 PWM 信号的占空比。
- Parameters
-
| value | The duty cycle as a floating-point value (0.0 to 1.0). 占空比,浮点值(0.0 到 1.0)。 |
- Returns
- ErrorCode indicating success or failure. 返回操作结果的错误码。
Implements LibXR::PWM.
◆ active_high_
| bool LibXR::CH32PWM::active_high_ |
|
private |
◆ channel_
| uint16_t LibXR::CH32PWM::channel_ |
|
private |
◆ complementary_
| bool LibXR::CH32PWM::complementary_ |
|
private |
◆ gpio_
| GPIO_TypeDef* LibXR::CH32PWM::gpio_ |
|
private |
◆ pin_
| uint16_t LibXR::CH32PWM::pin_ |
|
private |
◆ pin_remap_
| uint32_t LibXR::CH32PWM::pin_remap_ |
|
private |
◆ tim_
| TIM_TypeDef* LibXR::CH32PWM::tim_ |
|
private |
The documentation for this class was generated from the following file: