PWM用户态操作接口/sys/class/pwm 设备树设置了几路PWM,/sys/class/pwm目录下就会生成几路对应的pwmchipN。 调出PWM子目录 echo 0 > /sys/class/pwm/pwmchip2/export 关闭PWM子目录 echo 0 > /sys/class/pwm/pwmchip2/unexport 引脚电平正常或翻转 echo normal> /sys/class/pwm/pwmchip2/pwm0/polarity 频率*周期=1,计算频率。 设置PWM周期,单位ns echo 50000 > /sys/class/pwm/pwmchip2/pwm0/period 设置PWM占空比,单位ns echo 10000 > /sys/class/pwm/pwmchip2/pwm0/duty_cycle 使能PWM echo 1 > /sys/class/pwm/pwmchip2/pwm0/enable 关闭PWM echo 0 > /sys/class/pwm/pwmchip2/pwm0/enable |
|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )
GMT+8, 2024-11-24 21:12
Powered by Discuz! X3.4
© 2001-2013 Comsenz Inc.