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

PWM(脉冲宽度调制)控制的抽象基类。 Abstract base class for PWM (Pulse Width Modulation) control. More...

#include <pwm.hpp>

Inheritance diagram for LibXR::PWM:
[legend]

Classes

struct  Configuration
 PWM 配置参数 / Configuration parameters for PWM. More...
 

Public Member Functions

virtual ErrorCode SetDutyCycle (float value)=0
 设置 PWM 信号的占空比 / Sets the duty cycle of the PWM signal.
 
virtual ErrorCode SetConfig (Configuration config)=0
 配置 PWM 参数 / Configures the PWM settings.
 
virtual ErrorCode Enable ()=0
 启用 PWM 输出 / Enables the PWM output.
 
virtual ErrorCode Disable ()=0
 禁用 PWM 输出 / Disables the PWM output.
 

Detailed Description

PWM(脉冲宽度调制)控制的抽象基类。 Abstract base class for PWM (Pulse Width Modulation) control.

Definition at line 13 of file pwm.hpp.

Member Function Documentation

◆ Disable()

virtual ErrorCode LibXR::PWM::Disable ( )
pure virtual

禁用 PWM 输出 / Disables the PWM output.

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

Implemented in LibXR::CH32PWM, LibXR::ESP32PWM, LibXR::HPMPWM, LibXR::MSPM0PWM, and LibXR::STM32PWM.

◆ Enable()

virtual ErrorCode LibXR::PWM::Enable ( )
pure virtual

启用 PWM 输出 / Enables the PWM output.

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

Implemented in LibXR::CH32PWM, LibXR::ESP32PWM, LibXR::HPMPWM, LibXR::MSPM0PWM, and LibXR::STM32PWM.

◆ SetConfig()

virtual ErrorCode LibXR::PWM::SetConfig ( Configuration config)
pure virtual

配置 PWM 参数 / Configures the PWM settings.

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

Implemented in LibXR::CH32PWM, LibXR::ESP32PWM, LibXR::HPMPWM, LibXR::MSPM0PWM, and LibXR::STM32PWM.

◆ SetDutyCycle()

virtual ErrorCode LibXR::PWM::SetDutyCycle ( float value)
pure virtual

设置 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.

Implemented in LibXR::CH32PWM, LibXR::ESP32PWM, LibXR::HPMPWM, LibXR::MSPM0PWM, and LibXR::STM32PWM.


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