IDF中怎么没有mcpwm_timer_set_period这个接口呢
Posted: Thu Aug 22, 2024 7:41 am
在网页的编程指南看到有mcpwm_timer_set_period,但在ESP-IDF5.11跟esp-idf5.3都没找到这个函数,芯片是ESP32S3
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);