IDF中怎么没有mcpwm_timer_set_period这个接口呢
IDF中怎么没有mcpwm_timer_set_period这个接口呢
在网页的编程指南看到有mcpwm_timer_set_period,但在ESP-IDF5.11跟esp-idf5.3都没找到这个函数,芯片是ESP32S3
Re: IDF中怎么没有mcpwm_timer_set_period这个接口呢
解决了,用IDF5.3版本,要先清除之前IDF5.11版本的编译
-
- Posts: 198
- Joined: Sun Jun 23, 2024 6:18 pm
Re: IDF中怎么没有mcpwm_timer_set_period这个接口呢
使用 `mcpwm_config_t` 结构体来配置定时器周期和频率。
Code: Select all
mcpwm_config_t pwm_config;
pwm_config.frequency = 1000; // 1kHz
pwm_config.cmpr_a = 0; // 初始占空比 0%
pwm_config.cmpr_b = 0; // 初始占空比 0%
pwm_config.counter_mode = MCPWM_UP_COUNTER;
pwm_config.duty_mode = MCPWM_DUTY_MODE_0;
mcpwm_init(mcpwm_num, MCPWM_TIMER_0, &pwm_config);
Who is online
Users browsing this forum: Bing [Bot] and 172 guests