Class OdroidC2SysFsPwmOutputDevice
java.lang.Object
com.diozero.internal.spi.AbstractDevice
com.diozero.internal.board.odroid.OdroidC2SysFsPwmOutputDevice
- All Implemented Interfaces:
DeviceInterface
,GpioDeviceInterface
,PwmOutputDeviceInterface
,Closeable
,AutoCloseable
public class OdroidC2SysFsPwmOutputDevice extends AbstractDevice implements PwmOutputDeviceInterface
Setting up: 1 PWM Channel (GPIO 234; Pin 33):
sudo modprobe pwm-meson
sudo modprobe pwm-ctrl
2 PWM Channels (GPIO 234 & 235; Pins 33 / 19):
sudo modprobe pwm-meson npwm=2
sudo modprobe pwm-ctrl
-
Constructor Summary
Constructors Constructor Description OdroidC2SysFsPwmOutputDevice(String key, DeviceFactoryInterface deviceFactory, PwmPinInfo pinInfo, int frequency, float initialValue)
-
Method Summary
Modifier and Type Method Description protected void
closeDevice()
int
getGpio()
int
getPwmNum()
Get the device PWM output device numberfloat
getValue()
Get the current PWM output value (0..1)void
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, getKey, isOpen
Methods inherited from interface com.diozero.internal.spi.PwmOutputDeviceInterface
getMode
-
Constructor Details
-
OdroidC2SysFsPwmOutputDevice
public OdroidC2SysFsPwmOutputDevice(String key, DeviceFactoryInterface deviceFactory, PwmPinInfo pinInfo, int frequency, float initialValue)
-
-
Method Details
-
closeDevice
protected void closeDevice()- Specified by:
closeDevice
in classAbstractDevice
-
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
-
getValue
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
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
-