Package com.diozero.internal.spi
Interface InternalServoDeviceInterface
-
- All Superinterfaces:
AutoCloseable
,DeviceInterface
,GpioDeviceInterface
,InternalDeviceInterface
- All Known Implementing Classes:
PiconZero.PiconZeroServoDevice
,PwmServoDevice
public interface InternalServoDeviceInterface extends GpioDeviceInterface
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default DeviceMode
getMode()
int
getPulseWidthUs()
Get the current Servo pulse width in microseconds.int
getServoFrequency()
Get the Servo frequency in Hzint
getServoNum()
Get the device Servo device numbervoid
setPulseWidthUs(int pulseWidthUs)
Set the Servo output pulse width in microseconds.void
setServoFrequency(int frequencyHz)
Set the Servo frequency, most servos operate at 50Hz.-
Methods inherited from interface com.diozero.api.DeviceInterface
close
-
Methods inherited from interface com.diozero.internal.spi.GpioDeviceInterface
getGpio
-
Methods inherited from interface com.diozero.internal.spi.InternalDeviceInterface
getKey, isChild, isOpen, setChild
-
-
-
-
Method Detail
-
getServoNum
int getServoNum()
Get the device Servo device number- Returns:
- Device native Servo device number
-
getPulseWidthUs
int getPulseWidthUs() throws RuntimeIOException
Get the current Servo pulse width in microseconds.- Returns:
- Servo pulse width value in microseconds
- Throws:
RuntimeIOException
- if an I/O error occurs
-
setPulseWidthUs
void setPulseWidthUs(int pulseWidthUs) throws RuntimeIOException
Set the Servo output pulse width in microseconds.- Parameters:
pulseWidthUs
- New pulse width value in microseconds, range minPulseWidth to maxPulseWidth- Throws:
RuntimeIOException
- if an I/O error occurs
-
getServoFrequency
int getServoFrequency()
Get the Servo frequency in Hz- Returns:
- frequency in Hz
-
setServoFrequency
void setServoFrequency(int frequencyHz) throws RuntimeIOException
Set the Servo frequency, most servos operate at 50Hz.- Parameters:
frequencyHz
- frequency in Hz- Throws:
RuntimeIOException
- if an I/O error occurs
-
getMode
default DeviceMode getMode()
- Specified by:
getMode
in interfaceGpioDeviceInterface
-
-