Class SysFsPwmOutputDevice
- java.lang.Object
-
- com.diozero.internal.spi.AbstractDevice
-
- com.diozero.internal.provider.builtin.SysFsPwmOutputDevice
-
- All Implemented Interfaces:
DeviceInterface
,GpioDeviceInterface
,InternalDeviceInterface
,InternalPwmOutputDeviceInterface
,AutoCloseable
public class SysFsPwmOutputDevice extends AbstractDevice implements InternalPwmOutputDeviceInterface
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SysFsPwmOutputDevice.Polarity
-
Constructor Summary
Constructors Constructor Description SysFsPwmOutputDevice(String key, DeviceFactoryInterface deviceFactory, PinInfo pinInfo, int frequencyHz, float initialValue, MmapGpioInterface mmapGpio)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeDevice()
int
getGpio()
int
getPwmFrequency()
Get the PWM frequency in Hzint
getPwmNum()
Get the device PWM output device numberfloat
getValue()
Get the percentage that the device is "on", range 0..1static boolean
isSupported(NativeDeviceFactoryInterface deviceFactory, PinInfo pinInfo)
void
setPwmFrequency(int frequencyHz)
Set the PWM output frequencyvoid
setValue(float value)
Set the percentage relative "on" time, range 0..1-
Methods inherited from class com.diozero.internal.spi.AbstractDevice
close, getDeviceFactory, getKey, isChild, isOpen, setChild
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.diozero.api.DeviceInterface
close
-
Methods inherited from interface com.diozero.internal.spi.InternalDeviceInterface
getKey, isChild, isOpen, setChild
-
Methods inherited from interface com.diozero.internal.spi.InternalPwmOutputDeviceInterface
getMode
-
-
-
-
Constructor Detail
-
SysFsPwmOutputDevice
public SysFsPwmOutputDevice(String key, DeviceFactoryInterface deviceFactory, PinInfo pinInfo, int frequencyHz, float initialValue, MmapGpioInterface mmapGpio)
-
-
Method Detail
-
getGpio
public int getGpio()
- Specified by:
getGpio
in interfaceGpioDeviceInterface
-
getPwmNum
public int getPwmNum()
Description copied from interface:InternalPwmOutputDeviceInterface
Get the device PWM output device number- Specified by:
getPwmNum
in interfaceInternalPwmOutputDeviceInterface
- Returns:
- Device native PWM output
-
getValue
public float getValue()
Description copied from interface:InternalPwmOutputDeviceInterface
Get the percentage that the device is "on", range 0..1- Specified by:
getValue
in interfaceInternalPwmOutputDeviceInterface
- Returns:
- the percentage "on" time, range 0..1
-
setValue
public void setValue(float value)
Description copied from interface:InternalPwmOutputDeviceInterface
Set the percentage relative "on" time, range 0..1- Specified by:
setValue
in interfaceInternalPwmOutputDeviceInterface
- Parameters:
value
- new "on" time, range 0..1
-
getPwmFrequency
public int getPwmFrequency() throws RuntimeIOException
Description copied from interface:InternalPwmOutputDeviceInterface
Get the PWM frequency in Hz- Specified by:
getPwmFrequency
in interfaceInternalPwmOutputDeviceInterface
- Returns:
- frequency in Hz
- Throws:
RuntimeIOException
- if an I/O error occurs
-
setPwmFrequency
public void setPwmFrequency(int frequencyHz) throws RuntimeIOException
Description copied from interface:InternalPwmOutputDeviceInterface
Set the PWM output frequency- Specified by:
setPwmFrequency
in interfaceInternalPwmOutputDeviceInterface
- Parameters:
frequencyHz
- frequency in Hz- Throws:
RuntimeIOException
- if an I/O error occurs
-
closeDevice
protected void closeDevice()
- Specified by:
closeDevice
in classAbstractDevice
-
isSupported
public static boolean isSupported(NativeDeviceFactoryInterface deviceFactory, PinInfo pinInfo)
-
-