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
12class STM32PWM : public PWM
13{
14 public:
15 STM32PWM(TIM_HandleTypeDef* htim, uint32_t channel, bool complementary = false);
16
17 ErrorCode SetDutyCycle(float value) override;
18
19 ErrorCode SetConfig(Configuration config) override;
20
21 ErrorCode Enable() override;
22
23 ErrorCode Disable() override;
24
25 private:
26 TIM_HandleTypeDef* htim_;
27 uint32_t channel_;
28 bool complementary_;
29};
30
31} // namespace LibXR
32
33#endif
Abstract base class for PWM (Pulse Width Modulation) control. PWM(脉冲宽度调制)控制的抽象基类。
Definition pwm.hpp:14
ErrorCode SetConfig(Configuration config) override
Configures the PWM settings. 配置 PWM 参数。
Definition stm32_pwm.cpp:31
ErrorCode Disable() override
Disables the PWM output. 禁用 PWM 输出。
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_gpio.hpp:9
Configuration parameters for PWM. PWM 配置参数。
Definition pwm.hpp:23