'\" t .\" Title: pwm_set_relative_duty_cycle .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: January 2017 .\" Manual: Pulse-Width Modulation (PWM) .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "PWM_SET_RELATIVE_DUT" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "Pulse-Width Modulation (PWM)" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" pwm_set_relative_duty_cycle \- Set a relative duty cycle value .SH "SYNOPSIS" .HP \w'int\ pwm_set_relative_duty_cycle('u .BI "int pwm_set_relative_duty_cycle(struct\ pwm_state\ *\ " "state" ", unsigned\ int\ " "duty_cycle" ", unsigned\ int\ " "scale" ");" .SH "ARGUMENTS" .PP \fIstate\fR .RS 4 PWM state to fill .RE .PP \fIduty_cycle\fR .RS 4 relative duty cycle value .RE .PP \fIscale\fR .RS 4 scale in which \fIduty_cycle\fR is expressed .RE .SH "DESCRIPTION" .PP This functions converts a relative into an absolute duty cycle (expressed in nanoseconds), and puts the result in state\->duty_cycle\&. .PP For example if you want to configure a 50% duty cycle, call: .PP pwm_init_state(pwm, state); pwm_set_relative_duty_cycle(state, 50, 100); pwm_apply_state(pwm, state); .PP This functions returns \-EINVAL if \fIduty_cycle\fR and/or \fIscale\fR are inconsistent (\fIscale\fR == 0 or \fIduty_cycle\fR > \fIscale\fR)\&. .SH "COPYRIGHT" .br