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 and Description |
---|
OdroidC2SysFsPwmOutputDevice(String key,
DeviceFactoryInterface deviceFactory,
PwmPinInfo pinInfo,
int frequency,
float initialValue) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeDevice() |
int |
getGpio() |
int |
getPwmNum()
Get the device PWM output device number
|
float |
getValue()
Get the current PWM output value (0..1)
|
void |
setValue(float value)
Set the PWM output value (0..1)
|
close, getDeviceFactory, getKey, isOpen
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMode
close, getKey, isOpen
public OdroidC2SysFsPwmOutputDevice(String key, DeviceFactoryInterface deviceFactory, PwmPinInfo pinInfo, int frequency, float initialValue)
protected void closeDevice()
closeDevice
in class AbstractDevice
public int getGpio()
getGpio
in interface GpioDeviceInterface
public int getPwmNum()
PwmOutputDeviceInterface
getPwmNum
in interface PwmOutputDeviceInterface
public float getValue() throws RuntimeIOException
PwmOutputDeviceInterface
getValue
in interface PwmOutputDeviceInterface
RuntimeIOException
- if an I/O error occurspublic void setValue(float value) throws RuntimeIOException
PwmOutputDeviceInterface
setValue
in interface PwmOutputDeviceInterface
value
- Relative value in the range 0..1RuntimeIOException
- if an I/O error occursCopyright © 2016–2018 mattjlewis. All rights reserved.