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
43 HPMPWM(LibXRHpmPwmType* pwm, clock_name_t clock, uint8_t pwm_index, uint8_t cmp_index,
44 bool invert =
false,
bool auto_board_init =
true);
73 static constexpr uint8_t INVALID_CMP_INDEX = 0xFFu;
74 static uint8_t ResolveGptmrReloadCmpIndex(uint8_t duty_cmp_index);
76 LibXRHpmPwmType* pwm_;
82 bool auto_board_init_;
HPM 平台 PWM 驱动实现 / PWM driver implementation for HPM platform.
HPMPWM(LibXRHpmPwmType *pwm, clock_name_t clock, uint8_t pwm_index, uint8_t cmp_index, bool invert=false, bool auto_board_init=true)
构造 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.
Abstract base class for PWM (Pulse Width Modulation) control. PWM(脉冲宽度调制)控制的抽象基类。
Configuration parameters for PWM. PWM 配置参数。