Skip to main content

Module pwm

Module pwm 

Source
Expand description

PWM device node control contract (/devices/pwm/<name>).

§Control commands (kind b'p')

NumberCommandDirectionInputOutputEffect
0x00GET_INFOReadPwmVersionAbiPwmInfoAbiReturns channel count, max duty and period.
0x01SET_FREQUENCYWritePwmFrequencyAbiPwmInfoAbiSets the channel period in hertz.
0x02SET_DUTY_PERMILLEWritePwmDutyPermilleAbiPwmInfoAbiSets duty as 0..=1000 per mille of max duty.

Every struct starts with a version field equal to ABI_VERSION and carries zeroed reserved fields. A wrong version, a non-zero reserved field or an out-of-range value is InvalidArgument. A frequency the controller cannot express, or a fixed-period controller, is Unsupported.

Structs§

GET_INFO
PwmDutyPermilleAbi
Input of SET_DUTY_PERMILLE. permille is 0..=PERMILLE_FULL_SCALE.
PwmFrequencyAbi
Input of SET_FREQUENCY.
PwmInfoAbi
Channel description returned by every PWM command.
PwmVersionAbi
Carries only the ABI version and a reserved field. Input of GET_INFO.
SET_DUTY_PERMILLE
SET_FREQUENCY

Constants§

ABI_VERSION
Version of every PWM control ABI struct in this module.
PERMILLE_FULL_SCALE
Largest value accepted by SET_DUTY_PERMILLE.