| | |
| | | |
| | | printf(" -c[channel ] Specify PWM channel, such as 0\n"); |
| | | printf(" -f[freq ] Specify PWM frequency, default 2500(Hz)\n"); |
| | | printf(" -d[duty ] Specify PWM duty, default 50(50%)\n"); |
| | | printf(" -d[duty ] Specify PWM duty, default 50(50%%)\n"); |
| | | printf(" -s[status ] Specify PWM status: 1->on(default), 0->off\n"); |
| | | printf(" -h[help ] Display this help information\n"); |
| | | printf(" -v[version ] Display the program version\n"); |
| | |
| | | } |
| | | |
| | | /* configure PWM $channel */ |
| | | int config_pwm(int channel, int freq, int duty) |
| | | int config_pwm(int channel, int freq, int duty) |
| | | { |
| | | int fd; |
| | | char buf[32]; |
| | |
| | | if( (rv=export_pwm(channel, 1)) ) |
| | | { |
| | | printf("export PWM channel[%d] failed, rv=%d\n", channel, rv); |
| | | return rv; |
| | | return rv; |
| | | } |
| | | |
| | | if( (rv=config_pwm(channel, freq, duty)) ) |