|
libxr
Embedded C++ framework for bare-metal, RTOS and Linux
|
HPM 平台 PWM 驱动实现 / PWM driver implementation for HPM platform. More...
#include <hpm_pwm.hpp>
Public Types | |
| enum class | Polarity : uint8_t { NORMAL , INVERTED } |
| 输出极性 / Output polarity. More... | |
Public Member Functions | |
| HPMPWM (LibXRHpmPwmType *pwm, clock_name_t clock, uint8_t pwm_index, uint8_t cmp_index, Polarity polarity) | |
| 构造 HPM PWM 对象 / Construct an HPM PWM object. | |
| ErrorCode | SetDutyCycle (float value) override |
| 设置占空比 / Set PWM duty cycle. | |
| ErrorCode | SetConfig (Configuration config) override |
| 配置 PWM 频率 / Configure PWM frequency. | |
| ErrorCode | Enable () override |
| 启动 PWM 输出 / Start PWM output. | |
| ErrorCode | Disable () override |
| 停止 PWM 输出 / Stop PWM output. | |
Public Member Functions inherited from LibXR::PWM | |
HPM 平台 PWM 驱动实现 / PWM driver implementation for HPM platform.
Definition at line 30 of file hpm_pwm.hpp.
|
strong |
输出极性 / Output polarity.
| Enumerator | |
|---|---|
| NORMAL | 不反相 / Not inverted. |
| INVERTED | 反相输出 / Inverted output. |
Definition at line 34 of file hpm_pwm.hpp.
| HPMPWM::HPMPWM | ( | LibXRHpmPwmType * | pwm, |
| clock_name_t | clock, | ||
| uint8_t | pwm_index, | ||
| uint8_t | cmp_index, | ||
| Polarity | polarity ) |
构造 HPM PWM 对象 / Construct an HPM PWM object.
构造 PWM 实例 / Construct PWM instance.
| pwm | PWM 外设基地址 / PWM peripheral base address. |
| clock | PWM 对应时钟源 / Clock source used by this PWM instance. |
| pwm_index | PWM 输出通道索引 / PWM output index. |
| cmp_index | 与输出绑定的比较器索引 / Comparator index bound to the PWM output. |
| polarity | 输出极性 / Output polarity. |
说明:
pwm_ 按原生路径使用;gptmr_ 走 fallback 路径。 Notes:pwm_ is used in native path.gptmr_ is used as fallback. Definition at line 24 of file hpm_pwm.cpp.
|
overridevirtual |
Implements LibXR::PWM.
Definition at line 184 of file hpm_pwm.cpp.
|
overridevirtual |
Implements LibXR::PWM.
Definition at line 166 of file hpm_pwm.cpp.
|
overridevirtual |
配置 PWM 频率 / Configure PWM frequency.
Implements LibXR::PWM.
Definition at line 80 of file hpm_pwm.cpp.
|
overridevirtual |
设置占空比 / Set PWM duty cycle.
| value | 占空比范围 [0.0, 1.0] / Duty cycle in range [0.0, 1.0]. |
Implements LibXR::PWM.
Definition at line 37 of file hpm_pwm.cpp.