ioio.lib.impl
Class IncapImpl
java.lang.Object
ioio.lib.impl.AbstractResource
ioio.lib.impl.AbstractPin
ioio.lib.impl.IncapImpl
- All Implemented Interfaces:
- Closeable, PulseInput
public class IncapImpl
- extends AbstractPin
- implements PulseInput
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IncapImpl
public IncapImpl(IOIOImpl ioio,
PulseInput.PulseMode mode,
int incapNum,
int pin,
int clockRate,
int scale,
boolean doublePrecision)
throws ConnectionLostException
- Throws:
ConnectionLostException
getFrequency
public float getFrequency()
throws java.lang.InterruptedException,
ConnectionLostException
- Description copied from interface:
PulseInput
- Gets the momentary frequency of the measured signal. When scaling is
used, this is compensated for here, so the true frequency of the signal
will be returned.
The first call to this method may block shortly until the first data
update arrives. The client may interrupt the calling thread.
- Specified by:
getFrequency
in interface PulseInput
- Returns:
- The frequency, in Hz.
- Throws:
java.lang.InterruptedException
- The calling thread has been interrupted.
ConnectionLostException
- The connection with the IOIO has been lost.
getDuration
public float getDuration()
throws java.lang.InterruptedException,
ConnectionLostException
- Description copied from interface:
PulseInput
- Gets the pulse duration in case of pulse measurement mode, or the period
in case of frequency mode. When scaling is used, this is compensated for
here, so the duration of a single cycle will be returned.
The first call to this method may block shortly until the first data
update arrives. The client may interrupt the calling thread.
- Specified by:
getDuration
in interface PulseInput
- Returns:
- The duration, in seconds.
- Throws:
java.lang.InterruptedException
- The calling thread has been interrupted.
ConnectionLostException
- The connection with the IOIO has been lost.
waitPulseGetDuration
public float waitPulseGetDuration()
throws java.lang.InterruptedException,
ConnectionLostException
- Description copied from interface:
PulseInput
- Reads a single measurement from the queue. If the queue is empty, will
block until more data arrives. The calling thread may be interrupted in
order to abort the call. See interface documentation for further
explanation regarding the read queue.
This method may not be used if the interface has was opened in frequency
mode.
- Specified by:
waitPulseGetDuration
in interface PulseInput
- Returns:
- The duration, in seconds.
- Throws:
java.lang.InterruptedException
- The calling thread has been interrupted.
ConnectionLostException
- The connection with the IOIO has been lost.
dataReceived
public void dataReceived(byte[] data,
int size)
reportAdditionalBuffer
public void reportAdditionalBuffer(int bytesToAdd)
close
public void close()
- Specified by:
close
in interface Closeable
- Overrides:
close
in class AbstractPin
disconnected
public void disconnected()
- Overrides:
disconnected
in class AbstractResource