libxr
Embedded C++ framework for bare-metal, RTOS and Linux
Loading...
Searching...
No Matches
pwm.hpp
1#pragma once
2
3#include "libxr.hpp"
4
5namespace LibXR
6{
7
13class PWM
14{
15 public:
16 PWM() = default;
17
22 typedef struct
23 {
24 uint32_t frequency;
26
33 virtual ErrorCode SetDutyCycle(float value) = 0;
34
41 virtual ErrorCode SetConfig(Configuration config) = 0;
42
47 virtual ErrorCode Enable() = 0;
48
53 virtual ErrorCode Disable() = 0;
54};
55
56} // namespace LibXR
PWM(脉冲宽度调制)控制的抽象基类。 Abstract base class for PWM (Pulse Width Modulation) control.
Definition pwm.hpp:14
virtual ErrorCode SetDutyCycle(float value)=0
设置 PWM 信号的占空比 / Sets the duty cycle of the PWM signal.
virtual ErrorCode Disable()=0
禁用 PWM 输出 / Disables the PWM output.
virtual ErrorCode Enable()=0
启用 PWM 输出 / Enables the PWM output.
virtual ErrorCode SetConfig(Configuration config)=0
配置 PWM 参数 / Configures the PWM settings.
LibXR 命名空间 / LibXR namespace.
Definition ch32_can.hpp:14
ErrorCode
定义错误码枚举 / Defines an enumeration for error codes
PWM 配置参数 / Configuration parameters for PWM.
Definition pwm.hpp:23
uint32_t frequency
PWM 信号的频率(Hz) / PWM signal frequency in Hz.
Definition pwm.hpp:24