Package com.diozero.internal
Class SoftwarePwmOutputDevice
java.lang.Object
com.diozero.internal.provider.AbstractDevice
com.diozero.internal.SoftwarePwmOutputDevice
- All Implemented Interfaces:
DeviceInterface
,GpioDeviceInterface
,PwmOutputDeviceInterface
,java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Runnable
public class SoftwarePwmOutputDevice extends AbstractDevice implements PwmOutputDeviceInterface, java.lang.Runnable
-
Constructor Summary
Constructors Constructor Description SoftwarePwmOutputDevice(java.lang.String key, DeviceFactoryInterface deviceFactory, GpioDigitalOutputDeviceInterface digitalOutputDevice, int frequency, float initialValue)
-
Method Summary
Methods inherited from class com.diozero.internal.provider.AbstractDevice
close, getDeviceFactory, getKey, isOpen
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.diozero.internal.provider.DeviceInterface
close, getKey, isOpen
-
Constructor Details
-
SoftwarePwmOutputDevice
public SoftwarePwmOutputDevice(java.lang.String key, DeviceFactoryInterface deviceFactory, GpioDigitalOutputDeviceInterface digitalOutputDevice, int frequency, float initialValue)
-
-
Method Details
-
start
public void start() -
stop
public void stop() -
run
public void run()- Specified by:
run
in interfacejava.lang.Runnable
-
closeDevice
protected void closeDevice()- Specified by:
closeDevice
in classAbstractDevice
-
getValue
public float getValue()Description copied from interface:PwmOutputDeviceInterface
Get the current PWM output value (0..1)- Specified by:
getValue
in interfacePwmOutputDeviceInterface
- Returns:
- Range is 0..1
-
setValue
public void setValue(float value)Description copied from interface:PwmOutputDeviceInterface
Set the PWM output value (0..1)- Specified by:
setValue
in interfacePwmOutputDeviceInterface
- Parameters:
value
- Relative value in the range 0..1
-
getGpio
public int getGpio()- Specified by:
getGpio
in interfaceGpioDeviceInterface
-
getPwmNum
public int getPwmNum()Description copied from interface:PwmOutputDeviceInterface
Get the device PWM output device number- Specified by:
getPwmNum
in interfacePwmOutputDeviceInterface
- Returns:
- Device native PWM output
-