Package com.diozero.devices
Class PiconZero.PiconZeroPwmOutputDevice
- java.lang.Object
-
- com.diozero.internal.spi.AbstractDevice
-
- com.diozero.devices.PiconZero.PiconZeroPwmOutputDevice
-
- All Implemented Interfaces:
DeviceInterface
,GpioDeviceInterface
,InternalDeviceInterface
,PwmOutputDeviceInterface
,AutoCloseable
- Enclosing class:
- PiconZero
public static class PiconZero.PiconZeroPwmOutputDevice extends AbstractDevice implements PwmOutputDeviceInterface
-
-
Constructor Summary
Constructors Constructor Description PiconZeroPwmOutputDevice(PiconZero piconZero, String key, int gpio, int channel, float initialValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeDevice()
int
getChannel()
int
getGpio()
int
getPwmFrequency()
Get the PWM frequency in Hzint
getPwmNum()
Get the device PWM output device numberfloat
getValue()
Get the current PWM output value (0..1)void
setPwmFrequency(int frequencyHz)
Set the PWM output frequencyvoid
setValue(float value)
Set the PWM output value (0..1)-
Methods inherited from class com.diozero.internal.spi.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.api.DeviceInterface
close
-
Methods inherited from interface com.diozero.internal.spi.InternalDeviceInterface
getKey, isOpen
-
Methods inherited from interface com.diozero.internal.spi.PwmOutputDeviceInterface
getMode
-
-
-
-
Method Detail
-
getGpio
public int getGpio()
- Specified by:
getGpio
in interfaceGpioDeviceInterface
-
getChannel
public int getChannel()
-
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
-
getValue
public float getValue() throws RuntimeIOException
Description copied from interface:PwmOutputDeviceInterface
Get the current PWM output value (0..1)- Specified by:
getValue
in interfacePwmOutputDeviceInterface
- Returns:
- Range is 0..1
- Throws:
RuntimeIOException
- if an I/O error occurs
-
setValue
public void setValue(float value) throws RuntimeIOException
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- Throws:
RuntimeIOException
- if an I/O error occurs
-
closeDevice
protected void closeDevice() throws RuntimeIOException
- Specified by:
closeDevice
in classAbstractDevice
- Throws:
RuntimeIOException
-
getPwmFrequency
public int getPwmFrequency()
Description copied from interface:PwmOutputDeviceInterface
Get the PWM frequency in Hz- Specified by:
getPwmFrequency
in interfacePwmOutputDeviceInterface
- Returns:
- frequency in Hz
-
setPwmFrequency
public void setPwmFrequency(int frequencyHz) throws RuntimeIOException
Description copied from interface:PwmOutputDeviceInterface
Set the PWM output frequency- Specified by:
setPwmFrequency
in interfacePwmOutputDeviceInterface
- Parameters:
frequencyHz
- frequency in Hz- Throws:
RuntimeIOException
- if an I/O error occurs
-
-