3#include "hpm_clock_drv.h"
4#include "hpm_gptmr_drv.h"
8#if defined(PWM_SOC_CMP_MAX_COUNT) && defined(PWM_SOC_OUTPUT_TO_PWM_MAX_COUNT)
9#define LIBXR_HPM_PWM_SUPPORTED 1
10#include "hpm_pwm_drv.h"
11using LibXRHpmPwmType = PWM_Type;
13#define LIBXR_HPM_PWM_SUPPORTED 0
14using LibXRHpmPwmType = void;
17#if !LIBXR_HPM_PWM_SUPPORTED
18#define LIBXR_HPM_GPTMR_PWM_FALLBACK 1
20#define LIBXR_HPM_GPTMR_PWM_FALLBACK 0
53 HPMPWM(LibXRHpmPwmType* pwm, clock_name_t clock, uint8_t pwm_index, uint8_t cmp_index,
83 static constexpr uint8_t INVALID_CMP_INDEX = 0xFFu;
84 static uint8_t ResolveGptmrReloadCmpIndex(uint8_t duty_cmp_index);
86 LibXRHpmPwmType* pwm_;
HPM 平台 PWM 驱动实现 / PWM driver implementation for HPM platform.
Polarity
输出极性 / Output polarity.
@ NORMAL
不反相 / Not inverted.
@ INVERTED
反相输出 / Inverted output.
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 Disable() override
停止 PWM 输出 / Stop PWM output.
ErrorCode SetDutyCycle(float value) override
设置占空比 / Set PWM duty cycle.
ErrorCode Enable() override
启动 PWM 输出 / Start PWM output.
ErrorCode SetConfig(Configuration config) override
配置 PWM 频率 / Configure PWM frequency.
PWM(脉冲宽度调制)控制的抽象基类。 Abstract base class for PWM (Pulse Width Modulation) control.
LibXR 命名空间 / LibXR namespace.
ErrorCode
定义错误码枚举 / Defines an enumeration for error codes