libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
stm32_pwm.hpp
1#pragma once
2
3#include "main.h"
4
5#ifdef HAL_TIM_MODULE_ENABLED
6
7#include "pwm.hpp"
8
9namespace LibXR
10{
11
15class STM32PWM : public PWM
16{
17 public:
21 STM32PWM(TIM_HandleTypeDef* htim, uint32_t channel, bool complementary = false);
22
23 ErrorCode SetDutyCycle(float value) override;
24
25 ErrorCode SetConfig(Configuration config) override;
26
27 ErrorCode Enable() override;
28
29 ErrorCode Disable() override;
30
31 private:
32 TIM_HandleTypeDef* htim_;
33 uint32_t channel_;
34 bool complementary_;
35};
36
37} // namespace LibXR
38
39#endif
Abstract base class for PWM (Pulse Width Modulation) control. PWM(脉冲宽度调制)控制的抽象基类。
Definition pwm.hpp:14
STM32 PWM 驱动实现 / STM32 PWM driver implementation.
Definition stm32_pwm.hpp:16
ErrorCode SetConfig(Configuration config) override
Configures the PWM settings. 配置 PWM 参数。
Definition stm32_pwm.cpp:31
ErrorCode Disable() override
Disables the PWM output. 禁用 PWM 输出。
STM32PWM(TIM_HandleTypeDef *htim, uint32_t channel, bool complementary=false)
构造 PWM 对象 / Construct PWM object
Definition stm32_pwm.cpp:7
ErrorCode SetDutyCycle(float value) override
Sets the duty cycle of the PWM signal. 设置 PWM 信号的占空比。
Definition stm32_pwm.cpp:12
ErrorCode Enable() override
Enables the PWM output. 启用 PWM 输出。
LibXR 命名空间
Definition ch32_can.hpp:14
Configuration parameters for PWM. PWM 配置参数。
Definition pwm.hpp:23