pwm驱动在drivers/pwm目录下
配置
CONFIG_PWM=y
CONFIG_PWM_STM32=y
以stm32 timer3为例,其中st,perscaler为预分频,即1MHz,因为zephyr pwm时间以us计算,所以设置此值方便计算;
pinctrl-0是定义了相关的pwm channel通道对应的管脚,可以根据自己的需求定义
&timers3 {
status = "okay";
pwm3: pwm {
status = "okay";
st,prescaler = <71>;
pinctrl-0 = <&tim3_ch1_pwm_pa6 &tim3_ch2_pwm_pa7 &tim3_ch3_pwm_pb0 &tim3_ch4_pwm_pb1>;
};
};