libxr
Embedded C++ framework for bare-metal, RTOS and Linux
Loading...
Searching...
No Matches
LibXR::CH32PWM Class Reference

CH32 PWM 驱动实现 / CH32 PWM driver implementation. More...

#include <ch32_pwm.hpp>

Inheritance diagram for LibXR::CH32PWM:
[legend]
Collaboration diagram for LibXR::CH32PWM:
[legend]

Public Member Functions

 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
 设置 PWM 信号的占空比 / Sets the duty cycle of the PWM signal.
 
ErrorCode SetConfig (Configuration config) override
 配置 PWM 参数 / Configures the PWM settings.
 
ErrorCode Enable () override
 启用 PWM 输出 / Enables the PWM output.
 
ErrorCode Disable () override
 禁用 PWM 输出 / Disables the PWM output.
 
- Public Member Functions inherited from LibXR::PWM

Detailed Description

CH32 PWM 驱动实现 / CH32 PWM driver implementation.

Definition at line 12 of file ch32_pwm.hpp.

Member Function Documentation

◆ Disable()

ErrorCode LibXR::CH32PWM::Disable ( )
overridevirtual

禁用 PWM 输出 / Disables the PWM output.

Returns
返回操作结果的错误码 / ErrorCode indicating success or failure.

Implements LibXR::PWM.

◆ Enable()

ErrorCode LibXR::CH32PWM::Enable ( )
overridevirtual

启用 PWM 输出 / Enables the PWM output.

Returns
返回操作结果的错误码 / ErrorCode indicating success or failure.

Implements LibXR::PWM.

◆ SetConfig()

ErrorCode LibXR::CH32PWM::SetConfig ( Configuration config)
overridevirtual

配置 PWM 参数 / Configures the PWM settings.

Parameters
config配置结构体,包含 PWM 设置。 The configuration structure containing PWM settings.
Returns
返回操作结果的错误码 / ErrorCode indicating success or failure.

Implements LibXR::PWM.

◆ SetDutyCycle()

ErrorCode LibXR::CH32PWM::SetDutyCycle ( float value)
overridevirtual

设置 PWM 信号的占空比 / Sets the duty cycle of the PWM signal.

Parameters
value占空比,浮点值(0.0 到 1.0)。 The duty cycle as a floating-point value (0.0 to 1.0).
Returns
返回操作结果的错误码 / ErrorCode indicating success or failure.

Implements LibXR::PWM.


The documentation for this class was generated from the following file: